Library for led

RGB LED library

users/gimohd/code/LED/

[Not found]

lib/RGB.h

Committer:
gimohd
Date:
2015-12-10
Revision:
0:5368b27ca9d0

File content as of revision 0:5368b27ca9d0:


#ifndef RGB_H
#define RGB_H
#include <mbed.h>
#include <Color.h>


class RGB{
  
   public:
        /** Creates an instance of RGB
         *
         * @param r_pin the PinName of r_pin
         * @param g_pin the PinName of g_pin
         * @param b_pin the PinName of b_pin
         */
        RGB(PinName r_pin, PinName g_pin, PinName b_pin);
        /** Sets the color
         *
         * @param color sets the color to this instance of the class Color
         */
        void setColor(Color color);
        /** Sets the color
         *
         * @param red Set the red value of the color 0-255
         * @param green Set the green value of the color 0-255
         * @param blue Set the blue value of the color 0-255
         */
        void setColor(int red, int green, int blue);
        /** Sets the color
         *
         * @param color the hex value of the color u want to set
         */
        void setColor(int color);
        
        /** Sets the color
         *
         * @return the color
         */
        Color* getColor();
        /** Turns the led off
         *
         */
        void off();
        
    
    private:
        float toFloat(int value);
        PinName r_pin;
        PinName g_pin;
        PinName b_pin;
        PwmOut* r_out;
        PwmOut* g_out;
        PwmOut* b_out;
};

#endif