SOFT564Z Group 3 / Mbed 2 deprecated SOFT564Z_Group_3_final

Dependencies:   mbed Servo ros_lib_kinetic

RGB_LED/LED.cpp

Committer:
Stumi
Date:
2019-11-12
Revision:
5:bc5081f0c063
Child:
6:2cc2aac35868

File content as of revision 5:bc5081f0c063:

#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;
}