![](/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@25:d48f46d753fd, 2016-02-01 (annotated)
- Committer:
- nargetdev
- Date:
- Mon Feb 01 01:02:46 2016 +0000
- Revision:
- 25:d48f46d753fd
- Parent:
- 24:52319c0a14b8
alpha done refactoring to object oriented
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nargetdev | 24:52319c0a14b8 | 1 | #include "sinusoid.h" |
nargetdev | 25:d48f46d753fd | 2 | #include "mbed.h" |
nargetdev | 25:d48f46d753fd | 3 | |
nargetdev | 25:d48f46d753fd | 4 | //extern Serial pc; |
nargetdev | 24:52319c0a14b8 | 5 | |
nargetdev | 24:52319c0a14b8 | 6 | Sinusoid::Sinusoid(float wait, float frequency): |
nargetdev | 24:52319c0a14b8 | 7 | wait(wait),frequency(2*PI*frequency) {} |
nargetdev | 24:52319c0a14b8 | 8 | |
nargetdev | 25:d48f46d753fd | 9 | float Sinusoid::get_y(float time) |
nargetdev | 24:52319c0a14b8 | 10 | { |
nargetdev | 25:d48f46d753fd | 11 | if ( time >= wait) { |
nargetdev | 24:52319c0a14b8 | 12 | // printf("%d, %d, result: %d\r\n", rgb, (0x1 << i), (!(rgb & (0x1 << i)) ) ); |
nargetdev | 24:52319c0a14b8 | 13 | return (-cos( (time - wait)*frequency ) + 1) / 2.0; |
nargetdev | 24:52319c0a14b8 | 14 | } else { |
nargetdev | 25:d48f46d753fd | 15 | printf ("WAITING...\n\r"); |
nargetdev | 25:d48f46d753fd | 16 | return 0.0; |
nargetdev | 24:52319c0a14b8 | 17 | } |
nargetdev | 24:52319c0a14b8 | 18 | } |