Three LEDs Demo

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

Files at this revision

API Documentation at this revision

Comitter:
aafanasj
Date:
Fri Jan 19 23:48:16 2018 +0000
Parent:
57:98afe5d5ae5c
Commit message:
First Demo

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 98afe5d5ae5c -r 8461647d7e85 main.cpp
--- a/main.cpp	Thu Jan 18 12:45:02 2018 +0000
+++ b/main.cpp	Fri Jan 19 23:48:16 2018 +0000
@@ -1,11 +1,25 @@
 #include "mbed.h"
 
 DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+DigitalOut led3(LED3);
 
 // main() runs in its own thread in the OS
 int main() {
     while (true) {
-        led1 = !led1;
+        led1.write(1);
+        led2.write(0);
+        led3.write(0);
+        wait(0.5);
+
+        led1.write(0);
+        led2.write(1);
+        led3.write(0);
+        wait(0.5);
+
+        led1.write(0);
+        led2.write(0);
+        led3.write(1);
         wait(0.5);
     }
 }