Two simple classes for using the RGB led

Dependencies:   mbed

Dependents:   4180-lab3-RTOS 4180-FinalProject

SimpleRGB.h

Committer:
kswanson31
Date:
2016-10-10
Revision:
1:0008e30a2bda
Parent:
0:7a3ee33c0a53

File content as of revision 1:0008e30a2bda:

#ifndef SIMPLERGB_H
#define SIMPLERGB_H

#include "mbed.h"

class LightColor
{
    public:
        LightColor(float r, float g, float b);
        float red;
        float green;
        float blue;
};

class RGBLed
{
    public:
        RGBLed(PinName rpin, PinName gpin, PinName bpin);
        void write(float red, float green, float blue);
        void write(LightColor color);
        RGBLed operator = (LightColor color) {
            write(color);
            return *this;
        };
        
    private:
        PwmOut _rpin;
        PwmOut _gpin;
        PwmOut _bpin;
};

#endif