teapLED
Dependencies: PololuLedStrip mbed
Diff: color.h
- Revision:
- 0:84c4f17abdc1
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