teapLED

Dependencies:   PololuLedStrip mbed

Fork of tape_Led_Sample by naoki tanabe

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers color.h Source File

color.h

00001 #include "mbed.h"
00002 #include "PololuLedStrip.h"
00003 
00004 #define WEIT 1000
00005 #define LED_COUNT 60
00006 #define RED         255 ,0  ,0
00007 #define ORANGE      255 ,0  ,130
00008 #define YELLOW      255 ,255,0
00009 #define GREEN       0   ,255,0
00010 #define LIGHT_BLUE  0   ,255,255
00011 #define BLUE        0   ,0  ,255
00012 #define PURPLE      0   ,255,130
00013 #define PINK        255 ,0  ,255
00014 
00015 
00016 Timer timer;
00017 PololuLedStrip ledStrip(PA_5);
00018 rgb_color colors[LED_COUNT];
00019 
00020 void red (){
00021 
00022     for(uint32_t i = 0; i < LED_COUNT; i++){
00023             colors[i] = (rgb_color){255 ,0  ,0};
00024         }
00025         ledStrip.write(colors, LED_COUNT);
00026         wait_ms(WEIT);
00027 }
00028 
00029 void orange (){
00030 
00031     for(uint32_t i = 0; i < LED_COUNT; i++){
00032             colors[i] = (rgb_color){ORANGE};
00033         }
00034         ledStrip.write(colors, LED_COUNT);
00035         wait_ms(WEIT);
00036 
00037 }
00038 
00039 void yellow (){
00040 
00041     for(uint32_t i = 0; i < LED_COUNT; i++){
00042             colors[i] = (rgb_color){YELLOW};
00043         }
00044         ledStrip.write(colors, LED_COUNT);
00045         wait_ms(WEIT);
00046 
00047 }
00048 
00049 void green (){
00050 
00051     for(uint32_t i = 0; i < LED_COUNT; i++){
00052             colors[i] = (rgb_color){GREEN};
00053         }
00054         ledStrip.write(colors, LED_COUNT);
00055         wait_ms(WEIT);
00056 
00057 }
00058 
00059 void lgreen (){
00060 
00061     for(uint32_t i = 0; i < LED_COUNT; i++){
00062             colors[i] = (rgb_color){LIGHT_BLUE};
00063         }
00064         ledStrip.write(colors, LED_COUNT);
00065         wait_ms(WEIT);
00066 
00067 }
00068 
00069 void blue (){
00070 
00071     for(uint32_t i = 0; i < LED_COUNT; i++){
00072             colors[i] = (rgb_color){BLUE};
00073         }
00074         ledStrip.write(colors, LED_COUNT);
00075         wait_ms(WEIT);
00076 
00077 }
00078 
00079 void purple (){
00080 
00081     for(uint32_t i = 0; i < LED_COUNT; i++){
00082             colors[i] = (rgb_color){PURPLE};
00083         }
00084         ledStrip.write(colors, LED_COUNT);
00085         wait_ms(WEIT);
00086 
00087 }
00088 
00089 void pink (){
00090 
00091     for(uint32_t i = 0; i < LED_COUNT; i++){
00092             colors[i] = (rgb_color){PINK};
00093         }
00094         ledStrip.write(colors, LED_COUNT);
00095         wait_ms(WEIT);
00096 
00097 }