Example - 01 : Getting Started (Blinking LED)
WHAT ARE WE DOING HERE?
In this example, we will not be using any Grove modules. First, we’ll learn how to blink one of
the on-board LEDs that are featured on the LaunchPad development kit itself. All LaunchPad
kits feature a few user LEDs, typically a red LED. By running the example code, you will see the
LED switched on and off once per second.
THE CIRCUIT
We used the on-board red LED that is available on most LaunchPad kits. You don’t need to add
any other components.
CODE
This example is available here: File > Example > Basics > Blink
Blink
The basic Energia example.
Turns on an LED on for one second, then off for one second, repeatedly.
Change the LED define to blink other LEDs.
Hardware Required:
* LaunchPad with an LED
This example code is in the public domain.
*/
// most launchpads have a red LED
#define LED RED_LED
//see pins_energia.h for more LED definitions
//#define LED GREEN_LED
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(LED, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
digitalWrite(LED, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}