Please help, I am trying without success to write a program which uses the low power modes. My objective is to use an ISR to turn an led on for one second, then turn it off.
I have looked at several tutorials for the low power modes and copied the following very
Basic program which works okay by toggling an led every time the button is pushed. I
Modified the ISR to turn the green led on for a second, then off, it does not work. I did a lot of trial and error programming on this and cannot come up with a solution I am using an MSPG2553On a launchpad
Thank you for any help……
const int led1 = P1_0; // the pin that the red LED is attached to
const int led2 = P1_6; // the pin that the green LED is attached to
void setup()
{
pinMode (led2,OUTPUT); //Enable output on P1_6 (onboard green LED)
pinMode (P1_3,INPUT_PULLUP); //Enable inputs on P1_3 (onboard button)
pinMode (led1,OUTPUT); //Enable output on P1_0 (onboard red LED)
attachInterrupt(P1_3,Interrupt, FALLING); //attach interrupt routine to P1_3
}
void loop()
{
LPM4; // PUTS EVERYTHING IN LOW POWER MODE
}
void Interrupt(void) // interrupt routine
{
digitalWrite(led1,!digitalRead(led1)); //toggle the red LED
digitalWrite(led2, HIGH); // turn the green LED on
delay(1000); // wait for a second
digitalWrite(led2, LOW); // turn the green LED off
delay(1000); // wait for a second
}