![](/media/cache/profiles/IMG_0710-2.jpg.50x50_q85.jpg)
Light Show library for organic, calm, light display.
Dependencies: BLE_API mbed nRF51822
Fork of mbed_blinky by
Diff: main.cpp
- Revision:
- 8:5ed23e276c8a
- Parent:
- 4:81cea7a352b0
- Child:
- 9:1bd0f7a2ee71
--- a/main.cpp Thu Mar 26 22:33:50 2015 +0000 +++ b/main.cpp Sat Oct 10 07:22:30 2015 +0000 @@ -1,12 +1,48 @@ #include "mbed.h" - -DigitalOut myled(LED1); + + typedef unsigned char byte; + +//PwmOut blue(p18); +//PwmOut green(p19); +DigitalOut red(p18); +DigitalOut green(p19); +DigitalOut blue(p20); -int main() { - while(1) { - myled = 1; - wait(0.2); - myled = 0; - wait(0.2); +void error_code(){ + for(;;){ + green = !green; + blue = !blue; + red = !red; + wait(.5); } } + +void primative_channel(int rgb, byte duty){ + for (byte i = 0; i < 255; i++){ + switch (rgb){ + case 'r': + red = ( i < duty ); + break; + case 'g': + green = (i < duty); + break; + case 'b': + blue = (i < duty); + break; + default: + error_code(); + } + } +} + +int main() { +while(1){ + + primative_channel('g',20); + primative_channel('b',150); + for (int i = 0; i < 256; i++){ + primative_channel('b',i); + } + +} +} \ No newline at end of file