Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
Mark EasleyFrank Milburn
Published

Measure An Energia Application’s Power Usage (EnergyTrace)

How To Measure An Energia Application’s Power Usage with EnergyTrace

IntermediateProtip1,472
Measure An Energia Application’s Power Usage (EnergyTrace)

Things used in this project

Story

Read more

Schematics

Connections

Code

Code

Plain text
/*
Blink Energy - A sketch to explore the energy used to blink an LED on a MSP430G2 LaunchPad.
This example code is in the public domain.
*/
// the red LED is on pin 2 of the MSP430G2
#define LED 2

void setup() 
{
// initialize the digital pin as an output.
pinMode(LED, OUTPUT); 
}

void loop() 
{
digitalWrite(LED, HIGH); // turn the LED on (HIGH is the voltage level)
delay(50); // wait for a while
digitalWrite(LED, LOW);// turn the LED off by making the voltage LOW
delay(950);// wait again
}

Code

Plain text
void setup() 
{
// initialize all pins as an output and put them in a low state
for (int i = 2; i < 20; i++)
{
pinMode(i, OUTPUT);
digitalWrite(i, LOW);
}
}

Code

Plain text
void loop() 
{
digitalWrite(LED, HIGH); // turn the LED on (HIGH is the voltage level)
sleep(50); // wait for a while
digitalWrite(LED, LOW);// turn the LED off by making the voltage LOW
sleep(950);// wait again
}

Github

https://github.com/fmilburn3/Energia_LPM

Credits

Frank Milburn

Posted by Mark Easley

Comments

Please log in or sign up to comment.