Rising Edge Interrupt
i'm trying set interrupt act on rising edge coming motion detector activate output period of time. code have far:
i connected interrupt pin ground on board output continually stays on. appreciated.
code: [select]
//ewagner
//5/7/2002
//
#define led 13
volatile int flag = low;
void setup()
{
pinmode(led, output);
digitalwrite (led, low);
attachinterrupt(0, light, rising);
}
void loop()
{
if (flag == high);
{
digitalwrite (led, high);
delay(1000);
digitalwrite (led, low);
flag = low;
}
}
void light()
{
flag = high;
}
i connected interrupt pin ground on board output continually stays on. appreciated.
you have not defined interrupt service routine. there nothing when interrupt.
see:-
http://arduino.cc/it/reference/attachinterrupt
see:-
http://arduino.cc/it/reference/attachinterrupt
Arduino Forum > Using Arduino > Project Guidance > Rising Edge Interrupt
arduino
Comments
Post a Comment