02-01 SimpleLED
From Manuals
(Difference between revisions)
| Line 1: | Line 1: | ||
A very simple example that blinks LED1. LED1 blinks around 2 times a second. LED1 is located in the bottom left hand side of the board. | A very simple example that blinks LED1. LED1 blinks around 2 times a second. LED1 is located in the bottom left hand side of the board. | ||
| + | |||
| + | /* Program Example 2.1: Simple LED flashing | ||
| + | */ | ||
| + | #include "mbed.h" | ||
| + | DigitalOut myled(LED1); | ||
| + | |||
| + | int main() | ||
| + | { | ||
| + | while(1) { | ||
| + | myled = 1; | ||
| + | wait(0.2); | ||
| + | myled = 0; | ||
| + | wait(0.2); | ||
| + | } | ||
| + | } | ||
[[Image:BAM210_Blinky.jpeg|center|]] | [[Image:BAM210_Blinky.jpeg|center|]] | ||
Revision as of 14:34, 14 August 2014
A very simple example that blinks LED1. LED1 blinks around 2 times a second. LED1 is located in the bottom left hand side of the board.
/* Program Example 2.1: Simple LED flashing
*/
#include "mbed.h"
DigitalOut myled(LED1);
int main()
{
while(1) {
myled = 1;
wait(0.2);
myled = 0;
wait(0.2);
}
}

