![](/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
sinusoid.cpp@24:52319c0a14b8, 2016-01-30 (annotated)
- Committer:
- nargetdev
- Date:
- Sat Jan 30 20:07:55 2016 +0000
- Revision:
- 24:52319c0a14b8
- Child:
- 25:d48f46d753fd
main test harness
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nargetdev | 24:52319c0a14b8 | 1 | #include "sinusoid.h" |
nargetdev | 24:52319c0a14b8 | 2 | |
nargetdev | 24:52319c0a14b8 | 3 | Sinusoid::Sinusoid(float wait, float frequency): |
nargetdev | 24:52319c0a14b8 | 4 | wait(wait),frequency(2*PI*frequency) {} |
nargetdev | 24:52319c0a14b8 | 5 | |
nargetdev | 24:52319c0a14b8 | 6 | float Sinusoid::get_y() |
nargetdev | 24:52319c0a14b8 | 7 | { |
nargetdev | 24:52319c0a14b8 | 8 | if ( in >= WAIT[i]) { |
nargetdev | 24:52319c0a14b8 | 9 | // printf("%d, %d, result: %d\r\n", rgb, (0x1 << i), (!(rgb & (0x1 << i)) ) ); |
nargetdev | 24:52319c0a14b8 | 10 | return (-cos( (time - wait)*frequency ) + 1) / 2.0; |
nargetdev | 24:52319c0a14b8 | 11 | } else { |
nargetdev | 24:52319c0a14b8 | 12 | return = 0.0; |
nargetdev | 24:52319c0a14b8 | 13 | } |
nargetdev | 24:52319c0a14b8 | 14 | } |