Basic example showing how to blink LEDs.

Dependencies:   mbed

Committer:
arostm
Date:
Wed Jun 07 11:53:52 2017 +0000
Revision:
1:f9accd0898a1
Parent:
0:f6ee51382f4d
Adding new mbed library

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bcostm 0:f6ee51382f4d 1 #include "mbed.h"
bcostm 0:f6ee51382f4d 2
bcostm 0:f6ee51382f4d 3 DigitalOut green_led(LED1);
bcostm 0:f6ee51382f4d 4 DigitalOut red_led(LED2);
bcostm 0:f6ee51382f4d 5
bcostm 0:f6ee51382f4d 6 int main() {
bcostm 0:f6ee51382f4d 7
bcostm 0:f6ee51382f4d 8 while(1) {
bcostm 0:f6ee51382f4d 9
bcostm 0:f6ee51382f4d 10 // LEDs ON
bcostm 0:f6ee51382f4d 11 green_led = 1;
bcostm 0:f6ee51382f4d 12 red_led = 1;
bcostm 0:f6ee51382f4d 13
bcostm 0:f6ee51382f4d 14 wait(0.2); // wait 200 ms
bcostm 0:f6ee51382f4d 15
bcostm 0:f6ee51382f4d 16 // LEDs OFF
bcostm 0:f6ee51382f4d 17 green_led = 0;
bcostm 0:f6ee51382f4d 18 red_led = 0;
bcostm 0:f6ee51382f4d 19
bcostm 0:f6ee51382f4d 20 wait(0.8); // wait 800 ms
bcostm 0:f6ee51382f4d 21 }
bcostm 0:f6ee51382f4d 22
bcostm 0:f6ee51382f4d 23 }