![](/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:
- 11:2d3cc5459d5b
- Parent:
- 10:fc61583e9e8f
- Child:
- 13:ed92d45dc9ab
--- a/main.cpp Sun Oct 11 03:12:07 2015 +0000 +++ b/main.cpp Sun Oct 11 06:07:53 2015 +0000 @@ -1,8 +1,13 @@ #include "mbed.h" -#define HYSTERESIS_QUANTITY 1.57079632679 -#define calibrationTime 10 + +#define calibrationTime 3 + +#define HPI 1.571 +#define PI 3.1416 +#define HYSTERESIS_QUANTITY HPI*0.5 + unsigned long seed = 47; typedef unsigned char byte; @@ -67,24 +72,24 @@ float hysteresis = 0; - for (in = -1.571; in < hysteresis || (rgb ^ 0x7); in = in + 0.00628) + for (in = -HPI; in < hysteresis || rgb != 0x7; in = in + 0.00628) { unsigned int i = motion; if (motion){ hysteresis = in + HYSTERESIS_QUANTITY; - pc.printf("\n-----\nextra_hysteresis\n-----\n"); + pc.printf("hyst ||"); } tit = !tit; if (!(rgb & 0x1)) - rout = sin(in) + 1.0; + rout = sin(in + 1.4*(in + HPI)) + 1.0; else rout = 0.0f; if (!(rgb & 0x2)) - bout = sin(in + 1.3*(in+1.571) ) + 1.0; + bout = sin(in - 2.6*(in+1.571) ) + 1.0; else bout = 0.0f; if (!(rgb & 0x4)) - gout = sin(in + 4.2*(in+1.571) ) + 1.0; + gout = sin(in + 3.32*(in+1.571) ) + 1.0; else gout = 0.0f; @@ -103,8 +108,9 @@ if (bout < 0.01) rgb |= 0x4; } - wait(.005); + wait(.0001); } + pc.printf("\n%X\n", rgb); } int main() {