Quantcast
Channel: MSP430 Technical Forums
Viewing all articles
Browse latest Browse all 2077

Possible bug with attachInterrupt?

$
0
0

Greetings oh far wiser ones than I.

 

Just playing with entering LPM4 modes on a MSP430G2 revision 1.5 LaunchPad.

Energia 0010 or 0011 on Win7, with either a 2452 or 2553 chip:

 

int ledState = LOW;

void setup()
{
    pinMode(PUSH2, INPUT_PULLUP);
    pinMode(RED_LED, OUTPUT);
    //    digitalWrite(PUSH2, HIGH);
    digitalWrite(RED_LED, LOW);

    attachInterrupt(PUSH2, WakeUpISR, LOW);    
}

void loop()
{
    LPM4;
}

//Interrupt routine
void WakeUpISR()
{
    ledState = !ledState;
    digitalWrite(RED_LED, ledState);
}
 

 

Setting the attachInterrupt to LOW triggers on the rising edge instead (or is it on high...?!)

And although not defined according to the reference:

Setting the attachInterrupt to HIGH triggers on the falling edge instead.

 

Any help or a sanity check would be appreciated!

Regards,

Paul


Viewing all articles
Browse latest Browse all 2077

Trending Articles