test
Dependencies: LM75B Color mbed yeswecancoap Rgb
Diff: lib/rgb.cpp
- Revision:
- 2:ba4506b61052
- Parent:
- 1:e0a4afdbbffb
--- a/lib/rgb.cpp Fri Oct 23 14:48:16 2015 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -#include "rgb.h" - -RGB::RGB(PinName r_pin, PinName g_pin, PinName b_pin){ - this->r_out=new PwmOut(r_pin); - this->g_out=new PwmOut(g_pin); - this->b_out=new PwmOut(b_pin); - setColor(0,0,0); - } - -void RGB::setColor(int red, int green, int blue){ - r_out->write(1.0-toFloat(red)); - g_out->write(1.0-toFloat(green)); - b_out->write(1.0-toFloat(blue)); - } - -void RGB::setColor(int color){ - Color kleur=Color(color); - r_out->write(1.0-toFloat(kleur.getRed())); - g_out->write(1.0-toFloat(kleur.getGreen())); - b_out->write(1.0-toFloat(kleur.getBlue())); - } - -void RGB::setColor(Color color){ - r_out->write(toFloat(color.getRed())); - g_out->write(toFloat(color.getGreen())); - b_out->write(toFloat(color.getBlue())); - } - - -float RGB::toFloat (int floater){ - return (float) ((floater)/255.0f); - } \ No newline at end of file