with the tof code
Dependencies: mbed Servo ros_lib_kinetic
Diff: RGB_LED/LED.cpp
- Revision:
- 5:bc5081f0c063
- Child:
- 6:2cc2aac35868
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/RGB_LED/LED.cpp Tue Nov 12 10:36:59 2019 +0000 @@ -0,0 +1,51 @@ +#include "LED.h" + +cRBG_LED::cRBG_LED(DigitalOut DIAG_RED, PwmOut DIAG_BLU, PwmOut DIAG_GRN): _DIAG_RED(DIAG_RED), _DIAG_BLU(DIAG_BLU), _DIAG_GRN(DIAG_GRN) +{ + // Set initial condition of PWM + _DIAG_BLU.period(0.001); //1KHz + _DIAG_BLU = 0; + + // Set initial condition of PWM + _DIAG_GRN.period(0.001); //1KHz + _DIAG_GRN = 0; + + // Initial condition of output enables + _DIAG_RED = 0; +} + +void cRBG_LED::red_led() +{ + _DIAG_RED = 1; + _DIAG_BLU = 0.0; + _DIAG_GRN = 0.0; +} + +void cRBG_LED::blue_led() +{ + _DIAG_RED = 0; + _DIAG_BLU = 1.0; + _DIAG_GRN = 0.0; +} + +void cRBG_LED::green_led() +{ + _DIAG_RED = 0; + _DIAG_BLU = 0.0; + _DIAG_GRN = 1.0; +} + + +void cRBG_LED::yellow_led() +{ + _DIAG_RED = 1; + _DIAG_BLU = 0.0; + _DIAG_GRN = 0.35; +} + +void cRBG_LED::led_off() +{ + _DIAG_RED = 0; + _DIAG_BLU = 0; + _DIAG_GRN = 0; +} \ No newline at end of file