Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is digitalwritefast available? #103

Open
netkruzer opened this issue Mar 31, 2017 · 0 comments
Open

Is digitalwritefast available? #103

netkruzer opened this issue Mar 31, 2017 · 0 comments

Comments

@netkruzer
Copy link

netkruzer commented Mar 31, 2017

I'm trying to turn on my outputs faster than digitalwrite allows. Is there a way to directly talk to PORTD or some other Arduino like command to make it work?

I tried:
PORTD = B10101000;

but Arduino returned this error

'PORTD' was not declared in this scope

   PORTD = B10101000;

edit: I think I figured out my problem. digitalWrite works fast (3.2 microseconds on to off), but delayMicroseconds(1); actually delays 20 microseconds.

Edit again:

void delayCustom(int val){
    for(int i=0;i<val;i++){
        __NOP();
    }     
}

Calling that function will delay about 10us (microseconds) passing in 22.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant