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

Question about low power mode

$
0
0

My question is about where in the code I’m supposed to put the low power mode in. My example below does not work they way I thought it would.

As you can see I took the basic blink example and added the LPM!; at the bottom. I thought that placing it there, the behavior would be that the led

would turn, then off, then the micro would go to sleep, but it doesn't and it keeps blinking the led. What if I wanted it to only blink once and then

sleep, how can I use the LPM to do this?

/*
  Blink
  The basic Energia example.
  Turns on an LED on for one second, then off for one second, repeatedly.
  Pin 2 has an LED connected on MSP430 boards, has a name 'RED_LED' in the code.
  
  Hardware Required:
  * MSP-EXP430G2 LaunchPad
  
  This example code is in the public domain.
*/
  
// the setup routine runs once when you press reset:
void setup() {                
  // initialize the digital pin as an output.
  pinMode(RED_LED, OUTPUT);     
}

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(RED_LED, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(RED_LED, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second
  LPM1;
}

Viewing all articles
Browse latest Browse all 2077

Trending Articles