Light Show library for organic, calm, light display.
Dependencies: BLE_API mbed nRF51822
Fork of mbed_blinky by
Diff: sinusoid.h
- Revision:
- 25:d48f46d753fd
- Parent:
- 24:52319c0a14b8
- Child:
- 26:8bc9984c4600
--- a/sinusoid.h Sat Jan 30 20:07:55 2016 +0000 +++ b/sinusoid.h Mon Feb 01 01:02:46 2016 +0000 @@ -1,6 +1,9 @@ #ifndef SINUSOID_H #define SINUSOID_H +const float HPI = 1.571; +const float PI = 3.1416; + class Sinusoid { public: @@ -8,16 +11,18 @@ * Returns a float between 0 and 1 * - This value is zero if time is < wait **/ - float get_y(); - -private: + float get_y(float); + /** default constructor **/ + Sinusoid():wait(0), frequency(1){} Sinusoid(float wait, float frequency); - long int time; + void set_frequency(float f) {frequency = f;} + void set_wait_time(float w) {wait = w;} +private: + // PI macros static const float INCREMENT = 0.00628*4; - static const float HPI = 1.571; - static const float PI = 3.1416; + float wait; // before this y is zero float frequency;