Light Show library for organic, calm, light display.

Dependencies:   BLE_API mbed nRF51822

Fork of mbed_blinky by Mbed

Committer:
nargetdev
Date:
Mon Feb 01 01:02:46 2016 +0000
Revision:
25:d48f46d753fd
Parent:
24:52319c0a14b8
Child:
26:8bc9984c4600
alpha done refactoring to object oriented

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nargetdev 24:52319c0a14b8 1 #ifndef SINUSOID_H
nargetdev 24:52319c0a14b8 2 #define SINUSOID_H
nargetdev 24:52319c0a14b8 3
nargetdev 25:d48f46d753fd 4 const float HPI = 1.571;
nargetdev 25:d48f46d753fd 5 const float PI = 3.1416;
nargetdev 25:d48f46d753fd 6
nargetdev 24:52319c0a14b8 7 class Sinusoid {
nargetdev 24:52319c0a14b8 8 public:
nargetdev 24:52319c0a14b8 9
nargetdev 24:52319c0a14b8 10 /** Get value of Sinusoid
nargetdev 24:52319c0a14b8 11 * Returns a float between 0 and 1
nargetdev 24:52319c0a14b8 12 * - This value is zero if time is < wait
nargetdev 24:52319c0a14b8 13 **/
nargetdev 25:d48f46d753fd 14 float get_y(float);
nargetdev 25:d48f46d753fd 15 /** default constructor **/
nargetdev 25:d48f46d753fd 16 Sinusoid():wait(0), frequency(1){}
nargetdev 24:52319c0a14b8 17 Sinusoid(float wait, float frequency);
nargetdev 24:52319c0a14b8 18
nargetdev 25:d48f46d753fd 19 void set_frequency(float f) {frequency = f;}
nargetdev 25:d48f46d753fd 20 void set_wait_time(float w) {wait = w;}
nargetdev 25:d48f46d753fd 21 private:
nargetdev 25:d48f46d753fd 22
nargetdev 24:52319c0a14b8 23 // PI macros
nargetdev 24:52319c0a14b8 24 static const float INCREMENT = 0.00628*4;
nargetdev 25:d48f46d753fd 25
nargetdev 24:52319c0a14b8 26
nargetdev 24:52319c0a14b8 27 float wait; // before this y is zero
nargetdev 24:52319c0a14b8 28 float frequency;
nargetdev 24:52319c0a14b8 29
nargetdev 24:52319c0a14b8 30
nargetdev 24:52319c0a14b8 31 };
nargetdev 24:52319c0a14b8 32
nargetdev 24:52319c0a14b8 33 #endif