RGB LED (PWM)
Dependents: FRDM-KL46Z_SENSORDIG_HUMTEMP
Revision 0:627ea7b55fe3, committed 2019-05-31
- Comitter:
- MayraPeA
- Date:
- Fri May 31 00:29:55 2019 +0000
- Commit message:
- Sensor de temperatura y humedad (DHT22)
Changed in this revision
RGBLed.cpp | Show annotated file Show diff for this revision Revisions of this file |
RGBLed.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 627ea7b55fe3 RGBLed.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/RGBLed.cpp Fri May 31 00:29:55 2019 +0000 @@ -0,0 +1,15 @@ +#include "mbed.h" +#include "RGBLed.h" +RGBLed::RGBLed (PinName redpin, PinName greenpin, PinName bluepin) + : _redpin(redpin), _greenpin(greenpin), _bluepin(bluepin) +{ + + _redpin.period(0.0005); +} + +void RGBLed::write(float red,float green, float blue) +{ + _redpin = red; + _greenpin = green; + _bluepin = blue; +}
diff -r 000000000000 -r 627ea7b55fe3 RGBLed.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/RGBLed.h Fri May 31 00:29:55 2019 +0000 @@ -0,0 +1,13 @@ +#include "mbed.h" + +class RGBLed +{ +public: + RGBLed(PinName redpin, PinName greenpin, PinName bluepin); + void write(float red,float green, float blue); + +private: + PwmOut _redpin; + PwmOut _greenpin; + PwmOut _bluepin; +}; \ No newline at end of file