Skip to content

Is digitalwritefast available? #103

@netkruzer

Description

@netkruzer

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions