Light Show library for organic, calm, light display.
Dependencies: BLE_API mbed nRF51822
Fork of mbed_blinky by
Diff: sinusoid.cpp
- Revision:
- 25:d48f46d753fd
- Parent:
- 24:52319c0a14b8
diff -r 52319c0a14b8 -r d48f46d753fd sinusoid.cpp --- a/sinusoid.cpp Sat Jan 30 20:07:55 2016 +0000 +++ b/sinusoid.cpp Mon Feb 01 01:02:46 2016 +0000 @@ -1,14 +1,18 @@ #include "sinusoid.h" +#include "mbed.h" + +//extern Serial pc; Sinusoid::Sinusoid(float wait, float frequency): wait(wait),frequency(2*PI*frequency) {} -float Sinusoid::get_y() +float Sinusoid::get_y(float time) { - if ( in >= WAIT[i]) { + if ( time >= wait) { // printf("%d, %d, result: %d\r\n", rgb, (0x1 << i), (!(rgb & (0x1 << i)) ) ); return (-cos( (time - wait)*frequency ) + 1) / 2.0; } else { - return = 0.0; + printf ("WAITING...\n\r"); + return 0.0; } } \ No newline at end of file