teapLED
Dependencies: PololuLedStrip mbed
Fork of tape_Led_Sample by
Revision 0:84c4f17abdc1, committed 2017-09-01
- Comitter:
- tanabe2000
- Date:
- Fri Sep 01 02:18:12 2017 +0000
- Commit message:
- teapLED
Changed in this revision
--- /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
--- /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
--- /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 ();
+ }
+}
+
--- /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
