blinky with 3 colors
Fork of mbed-os-example-mbed5-blinky by
Diff: main.cpp
- Revision:
- 18:d15cf1cad4c9
- Parent:
- 17:f1532314d1a9
- Child:
- 19:ff7ac8de56f9
--- a/main.cpp Wed Nov 16 20:02:33 2016 +0000
+++ b/main.cpp Wed Nov 16 21:09:41 2016 +0000
@@ -1,15 +1,22 @@
#include "mbed.h"
DigitalOut led1(LED1, 0);
-DigitalOut led2(LED2, 1);
-
+DigitalOut led2(LED2, 0);
+DigitalOut led3(LED3, 0);
// main() runs in its own thread in the OS
// (note the calls to Thread::wait below for delays)
+
int main() {
+ uint16_t color = 0;
while (true) {
Thread::wait(1000);
- led1 = !led1;
- led2 = !led2;
+ //led1 = !led1;
+ //led2 = !led2;
+ color++;
+ color = color & 0x7;
+ led1 = color & 0x1;
+ led2 = (color >> 1) & 0x1;
+ led3 = (color >> 2) & 0x1;
}
}
