Light Show library for organic, calm, light display.

Dependencies:   BLE_API mbed nRF51822

Fork of mbed_blinky by Mbed

light_show.h

Committer:
nargetdev
Date:
2016-02-01
Revision:
26:8bc9984c4600
Parent:
25:d48f46d753fd
Child:
27:a55dde8334f3

File content as of revision 26:8bc9984c4600:

#ifndef LIGHT_SHOW_H
#define LIGHT_SHOW_H

#include "macros.h"
#include "config.h"
#include "utility.h"

#include "rgb_led.h"
#include "sinusoid.h"

extern Serial pc;

const float HYSTERESIS_QUANTITY = PI*2;
const float INCREMENT = 0.00628f * 2;

class LightShow
{
public:
    LightShow(Rgb*);
    
    /* randomize parameters of the 3 sine waves */
    void randomize_params();
    
    /* Displays light show.
    *  The light show is a composition of 3 sine waves for 3 channel LEDs
    **/
    void show();
    
    /** sanity check for debugging **/
    void simple_show();
    
private:
    Rgb* strip;
    Sinusoid sine_waves[3];

    // get some randomness
    Timer t;

    static const float HYSTERESIS_QUANTITY = PI/4;

    float time; // phase
    uint8_t finished; // bit mask for smooth fade out
    float hysteresis;
    float rgb_c[3];

    void update_rgb();
};

#endif