I'm new on energia, and just trying to use interrupt with an external stimulus. I'm using PIR sensor on P1_4 to fire the interrupt flag and light the red led on launchpad but my code doesn't work;
//PIR input on port P1_4
volatile int state = LOW;
void setup()
{
pinMode(P1_4, INPUT);
pinMode(RED_LED, OUTPUT);
attachInterrupt(P1_4, A, RISING);
}
void loop()
{
digitalWrite(RED_LED, state);
}
void A(){
state = !state;
}
Also, I want to add LPM on this code but I'm not sure where to add it.
Thanks in advance.