Library for RGB LED

Dependents:   Robot_Love

color.cpp

Committer:
wqz9822
Date:
2015-10-29
Revision:
0:8f07ffe423ce

File content as of revision 0:8f07ffe423ce:

#include "color.h"

LEDColor:: LEDColor(int r, int g, int b)
    : red(r/255.0), green(g/255.0), blue(b/255.0)
{
}
//Operator overload to adjust brightness with no color change
LEDColor operator * (const LEDColor& x, const float& b)
{
    return LEDColor(x.red*b,x.green*b,x.blue*b);
}
//Operator overload to add colors
LEDColor operator + (const LEDColor& x, const LEDColor& y)
{
    return LEDColor(x.red+y.red,x.green+y.green,x.blue+y.blue);
}