j
Dependencies: mbed yeswecancoap C12832 LM75B
Diff: lib/RGB.cpp
- Revision:
- 1:92958e26bf2e
- Parent:
- 0:92d2ef9f009d
--- a/lib/RGB.cpp Fri Oct 23 11:51:28 2015 +0000 +++ b/lib/RGB.cpp Fri Oct 23 14:58:08 2015 +0000 @@ -12,24 +12,31 @@ } void RGB::setColor(Color color){ - + delete this->color; r_out->write(toFloat(color.getRed())); g_out->write(toFloat(color.getGreen())); b_out->write(toFloat(color.getBlue())); + this->color = &color; } void RGB::setColor(int red, int green, int blue){ + delete this->color; r_out->write(toFloat(red)); g_out->write(toFloat(green)); b_out->write(toFloat(blue)); + this->color = new Color(red, green, blue); } void RGB::setColor(int color){ - Color kleur = Color(color); - r_out->write(toFloat(kleur.getRed())); - g_out->write(toFloat(kleur.getGreen())); - b_out->write(toFloat(kleur.getBlue())); + delete this->color; + Color* kleur = new Color(color); + r_out->write(toFloat(kleur->getRed())); + g_out->write(toFloat(kleur->getGreen())); + b_out->write(toFloat(kleur->getBlue())); + this->color = kleur; } - +Color* RGB::getColor(){ + return color; +} \ No newline at end of file