Hexiwear / Mbed OS Hexi_Serial_Rgb_Example

Files at this revision

API Documentation at this revision

Comitter:
GregC
Date:
Mon Aug 15 18:15:42 2016 +0000
Commit message:
Serial and RGB LED program example for Hexiwear

Changed in this revision

.gitignore Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-os.lib Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r ec68cfbf0495 .gitignore
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.gitignore	Mon Aug 15 18:15:42 2016 +0000
@@ -0,0 +1,4 @@
+.build
+.mbed
+projectfiles
+*.py*
diff -r 000000000000 -r ec68cfbf0495 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Aug 15 18:15:42 2016 +0000
@@ -0,0 +1,32 @@
+#include "mbed.h"
+#include "rtos.h"
+
+DigitalOut led_red(PTC8);
+DigitalOut led_green(PTD0);
+DigitalOut led_blue(PTC9);
+Serial pc(USBTX, USBRX);
+
+int main()
+{
+    pc.printf("Tell me the RGB LED Color\r\n");
+
+    while (true) {
+        pc.printf("Red\r\n"); // print the value of variable i
+        led_red=0;
+        led_green=1;
+        led_blue=1;
+        Thread::wait(1000); // wait a small period of time
+        pc.printf("Green\r\n"); // print the value of variable i
+        led_red=1;
+        led_green=0;
+        led_blue=1;
+        Thread::wait(1000); // wait a small period of time
+        pc.printf("Blue\r\n"); // print the value of variable i
+        led_red=1;
+        led_green=1;
+        led_blue=0;
+        Thread::wait(1000); // wait a small period of time
+ 
+    }
+}
+
diff -r 000000000000 -r ec68cfbf0495 mbed-os.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-os.lib	Mon Aug 15 18:15:42 2016 +0000
@@ -0,0 +1,1 @@
+https://github.com/ARMmbed/mbed-os/#0712b8adf6bbc7eb796d5dac26f95d79d40745ef