blinky with 3 colors

Fork of mbed-os-example-mbed5-blinky by mbed-os-examples

Committer:
Pieter56
Date:
Wed Nov 16 20:02:33 2016 +0000
Revision:
17:f1532314d1a9
Parent:
8:bb09890333fe
Child:
18:d15cf1cad4c9
Added 2 led's alternatively blinking (red and green)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jonathan Austin 0:2757d7abb7d9 1 #include "mbed.h"
Jonathan Austin 0:2757d7abb7d9 2
Pieter56 17:f1532314d1a9 3 DigitalOut led1(LED1, 0);
Pieter56 17:f1532314d1a9 4 DigitalOut led2(LED2, 1);
Jonathan Austin 0:2757d7abb7d9 5
Jonathan Austin 1:846c97078558 6 // main() runs in its own thread in the OS
Jonathan Austin 1:846c97078558 7 // (note the calls to Thread::wait below for delays)
Jonathan Austin 0:2757d7abb7d9 8 int main() {
Jonathan Austin 0:2757d7abb7d9 9 while (true) {
Pieter56 17:f1532314d1a9 10 Thread::wait(1000);
Jonathan Austin 0:2757d7abb7d9 11 led1 = !led1;
Pieter56 17:f1532314d1a9 12 led2 = !led2;
Jonathan Austin 0:2757d7abb7d9 13 }
Jonathan Austin 0:2757d7abb7d9 14 }
Jonathan Austin 1:846c97078558 15