with the tof code

Dependencies:   mbed Servo ros_lib_kinetic

Committer:
Stumi
Date:
Tue Nov 12 10:36:59 2019 +0000
Revision:
5:bc5081f0c063
Child:
6:2cc2aac35868
Code added to control the RGB LED

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Stumi 5:bc5081f0c063 1 #include "LED.h"
Stumi 5:bc5081f0c063 2
Stumi 5:bc5081f0c063 3 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)
Stumi 5:bc5081f0c063 4 {
Stumi 5:bc5081f0c063 5 // Set initial condition of PWM
Stumi 5:bc5081f0c063 6 _DIAG_BLU.period(0.001); //1KHz
Stumi 5:bc5081f0c063 7 _DIAG_BLU = 0;
Stumi 5:bc5081f0c063 8
Stumi 5:bc5081f0c063 9 // Set initial condition of PWM
Stumi 5:bc5081f0c063 10 _DIAG_GRN.period(0.001); //1KHz
Stumi 5:bc5081f0c063 11 _DIAG_GRN = 0;
Stumi 5:bc5081f0c063 12
Stumi 5:bc5081f0c063 13 // Initial condition of output enables
Stumi 5:bc5081f0c063 14 _DIAG_RED = 0;
Stumi 5:bc5081f0c063 15 }
Stumi 5:bc5081f0c063 16
Stumi 5:bc5081f0c063 17 void cRBG_LED::red_led()
Stumi 5:bc5081f0c063 18 {
Stumi 5:bc5081f0c063 19 _DIAG_RED = 1;
Stumi 5:bc5081f0c063 20 _DIAG_BLU = 0.0;
Stumi 5:bc5081f0c063 21 _DIAG_GRN = 0.0;
Stumi 5:bc5081f0c063 22 }
Stumi 5:bc5081f0c063 23
Stumi 5:bc5081f0c063 24 void cRBG_LED::blue_led()
Stumi 5:bc5081f0c063 25 {
Stumi 5:bc5081f0c063 26 _DIAG_RED = 0;
Stumi 5:bc5081f0c063 27 _DIAG_BLU = 1.0;
Stumi 5:bc5081f0c063 28 _DIAG_GRN = 0.0;
Stumi 5:bc5081f0c063 29 }
Stumi 5:bc5081f0c063 30
Stumi 5:bc5081f0c063 31 void cRBG_LED::green_led()
Stumi 5:bc5081f0c063 32 {
Stumi 5:bc5081f0c063 33 _DIAG_RED = 0;
Stumi 5:bc5081f0c063 34 _DIAG_BLU = 0.0;
Stumi 5:bc5081f0c063 35 _DIAG_GRN = 1.0;
Stumi 5:bc5081f0c063 36 }
Stumi 5:bc5081f0c063 37
Stumi 5:bc5081f0c063 38
Stumi 5:bc5081f0c063 39 void cRBG_LED::yellow_led()
Stumi 5:bc5081f0c063 40 {
Stumi 5:bc5081f0c063 41 _DIAG_RED = 1;
Stumi 5:bc5081f0c063 42 _DIAG_BLU = 0.0;
Stumi 5:bc5081f0c063 43 _DIAG_GRN = 0.35;
Stumi 5:bc5081f0c063 44 }
Stumi 5:bc5081f0c063 45
Stumi 5:bc5081f0c063 46 void cRBG_LED::led_off()
Stumi 5:bc5081f0c063 47 {
Stumi 5:bc5081f0c063 48 _DIAG_RED = 0;
Stumi 5:bc5081f0c063 49 _DIAG_BLU = 0;
Stumi 5:bc5081f0c063 50 _DIAG_GRN = 0;
Stumi 5:bc5081f0c063 51 }