Light Show library for organic, calm, light display.
Dependencies: BLE_API mbed nRF51822
Fork of mbed_blinky by
Diff: rgb_led.h
- Revision:
- 23:4bb74b53e112
- Child:
- 24:52319c0a14b8
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rgb_led.h Fri Jan 29 20:22:02 2016 +0000 @@ -0,0 +1,56 @@ + + +class Rgb +{ +private: + +//#define NRFDK +#define MKIT +// Handles for actually writing the appropriate PWM regs +#ifdef NRFDK + InterruptIn motion(p20); + PwmOut red(p21); + PwmOut green(p22); + PwmOut blue(p23); +#endif + +#ifdef MKIT +//PwmOut red(p18); +//PwmOut green(p19); +//PwmOut blue(p20); +// PwmOut red(p6); +// PwmOut green(p22); +// PwmOut blue(p30); +// InterruptIn motion(p1); +#endif + + + // PI macros + static const float INCREMENT = 0.00628*4; + static const float HPI = 1.571; + static const float PI = 3.1416; + static const float HYSTERESIS_QUANTITY = PI/4; + + // Arbitrary params for the show + static const float RWAIT = 0; + static const float GWAIT = PI/8; + static const float BWAIT = PI/4; + float WAIT [3]; + float SCALE [3]; + + // channel operators + float rgb_c[3]; + float in; + uint8_t rgb; + float hysteresis; + + uint8_t i; + bool mov; + + void randomize_params(); + void update_rgb_values (); + void write_rgb (); + +public: + void show(); +}; \ No newline at end of file