teapLED

Dependencies:   PololuLedStrip mbed

Files at this revision

API Documentation at this revision

Comitter:
tanabe2000
Date:
Fri Sep 01 02:18:12 2017 +0000
Commit message:
teapLED

Changed in this revision

PololuLedStrip.lib Show annotated file Show diff for this revision Revisions of this file
color.h 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.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 84c4f17abdc1 PololuLedStrip.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PololuLedStrip.lib	Fri Sep 01 02:18:12 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/DavidEGrayson/code/PololuLedStrip/#d72818ba17cc
diff -r 000000000000 -r 84c4f17abdc1 color.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/color.h	Fri Sep 01 02:18:12 2017 +0000
@@ -0,0 +1,97 @@
+#include "mbed.h"
+#include "PololuLedStrip.h"
+
+#define WEIT 1000
+#define LED_COUNT 60
+#define RED         255 ,0  ,0
+#define ORANGE      255 ,0  ,130
+#define YELLOW      255 ,255,0
+#define GREEN       0   ,255,0
+#define LIGHT_BLUE  0   ,255,255
+#define BLUE        0   ,0  ,255
+#define PURPLE      0   ,255,130
+#define PINK        255 ,0  ,255
+
+
+Timer timer;
+PololuLedStrip ledStrip(PA_5);
+rgb_color colors[LED_COUNT];
+
+void red (){
+
+    for(uint32_t i = 0; i < LED_COUNT; i++){
+            colors[i] = (rgb_color){255 ,0  ,0};
+        }
+        ledStrip.write(colors, LED_COUNT);
+        wait_ms(WEIT);
+}
+
+void orange (){
+
+    for(uint32_t i = 0; i < LED_COUNT; i++){
+            colors[i] = (rgb_color){ORANGE};
+        }
+        ledStrip.write(colors, LED_COUNT);
+        wait_ms(WEIT);
+
+}
+
+void yellow (){
+
+    for(uint32_t i = 0; i < LED_COUNT; i++){
+            colors[i] = (rgb_color){YELLOW};
+        }
+        ledStrip.write(colors, LED_COUNT);
+        wait_ms(WEIT);
+
+}
+
+void green (){
+
+    for(uint32_t i = 0; i < LED_COUNT; i++){
+            colors[i] = (rgb_color){GREEN};
+        }
+        ledStrip.write(colors, LED_COUNT);
+        wait_ms(WEIT);
+
+}
+
+void lgreen (){
+
+    for(uint32_t i = 0; i < LED_COUNT; i++){
+            colors[i] = (rgb_color){LIGHT_BLUE};
+        }
+        ledStrip.write(colors, LED_COUNT);
+        wait_ms(WEIT);
+
+}
+
+void blue (){
+
+    for(uint32_t i = 0; i < LED_COUNT; i++){
+            colors[i] = (rgb_color){BLUE};
+        }
+        ledStrip.write(colors, LED_COUNT);
+        wait_ms(WEIT);
+
+}
+
+void purple (){
+
+    for(uint32_t i = 0; i < LED_COUNT; i++){
+            colors[i] = (rgb_color){PURPLE};
+        }
+        ledStrip.write(colors, LED_COUNT);
+        wait_ms(WEIT);
+
+}
+
+void pink (){
+
+    for(uint32_t i = 0; i < LED_COUNT; i++){
+            colors[i] = (rgb_color){PINK};
+        }
+        ledStrip.write(colors, LED_COUNT);
+        wait_ms(WEIT);
+
+}
\ No newline at end of file
diff -r 000000000000 -r 84c4f17abdc1 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Sep 01 02:18:12 2017 +0000
@@ -0,0 +1,19 @@
+#include "mbed.h"
+#include "color.h"
+
+int main()
+{
+    timer.start();
+
+    while(1) {
+         red   ();
+         orange();
+         yellow();
+         green ();
+         lgreen();
+         blue  ();
+         purple();
+         pink  ();
+    }
+}
+
diff -r 000000000000 -r 84c4f17abdc1 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Sep 01 02:18:12 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/a330f0fddbec
\ No newline at end of file