Jump to content

Recommended Posts

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.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...