Light Show library for organic, calm, light display.

Dependencies:   BLE_API mbed nRF51822

Fork of mbed_blinky by Mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers rgb_led.h Source File

rgb_led.h

00001 /* LED driver encapsulation */
00002 #ifndef RGB_LED_H
00003 #define RGB_LED_H
00004 
00005 #include "mbed.h"
00006 
00007 
00008 enum channel { RED, GREEN, BLUE };
00009 
00010 class Rgb
00011 {
00012 public:
00013     /** Declare a 3-channel LED interface **/
00014     Rgb(PinName r, PinName g, PinName b);
00015     
00016     void init();
00017     
00018     /* write three channels */
00019     void write_rgb (float red, float green, float blue);
00020     
00021     /** write a single value **/
00022     void write(int channel, float intensity);
00023 
00024     /* turn off all chanels */
00025     void quiet();
00026     
00027 
00028 
00029     /** Check all 3 channels for heartbeat **/
00030     void channel_check();
00031 
00032 private:
00033     PwmOut red;
00034     PwmOut green;
00035     PwmOut blue;
00036 
00037 
00038 
00039     Serial* pc;
00040 
00041 
00042     bool mov;
00043 
00044 
00045 
00046 
00047     void randomize_params();
00048     void update_rgb_values ();
00049     
00050     
00051 
00052 
00053 };
00054 
00055 #endif