Go Down

Topic: attatched interupt seems to trip on power up (Read 1 time) previous topic - next topic

SouthernAtHeart

I discovered that when I power up the system, sometimes it acts like the button was pressed on D2.  It's just a push button, NO.

Code: [Select]

...in Setup()
    attachInterrupt(0, OverrideSwitch, FALLING);//TURN ON INTERUPT OF MOMENTARY PUSHBUTTON ON PIN 2
    digitalWrite(2, HIGH);             //TURN ON PULLUP FOR PUSHBUTTON ON PIN 2 

...

void OverrideSwitch(){
ButtonFlag = true; //set the trigger to activate the door
}


I've change the Interrupt call routine to this, but it seems a bit lame.  It just checks to make sure a few seconds have passed since startup
Code: [Select]
    if(millis() > 5000) ButtonFlag = true; //set the trigger to activate the door

MarkT

[ I DO NOT respond to personal messages, I WILL delete them unread, use the forum please ]

SouthernAtHeart


Do you have pull-up or pull-down?

...just the line digitalWrite(2, HIGH);

dhunt

Try attaching the interrupt *after* you enable the pull-up?

SouthernAtHeart


Try attaching the interrupt *after* you enable the pull-up?

I tried this to no affect.  Anyway, the 5 second delay takes care of it...

Go Up