Jelle Raes / Mbed 2 deprecated Projec_1_projectlab

Dependencies:   EthernetInterface LM75B mbed-rtos mbed

Fork of communication by Jelle Raes

led.cpp

Committer:
JelleRaes
Date:
2018-03-23
Revision:
4:4848f847d2ce
Parent:
3:9c600fb19ed2

File content as of revision 4:4848f847d2ce:

#include "mbed.h"
#include <string.h>
#include "led.h"

Serial pc3(USBTX, USBRX);
led::led(void)
{
/**
colors[].name = "";
colors[].redValue = ;
colors[].greenValue = ;
colors[].blueValue = ;
*/    
    
    count =8;
    colors[0].name= "RED";
    colors[0].redValue = 0.0;
    colors[0].greenValue = 1.0;
    colors[0].blueValue = 1.0;
    
    colors[1].name= "GREEN";
    colors[1].redValue = 1.0;
    colors[1].greenValue = 0.0;
    colors[1].blueValue = 1.0;
    
    colors[2].name= "BLUE";
    colors[2].redValue = 1.0;
    colors[2].greenValue = 1.0;
    colors[2].blueValue = 0.0;
    
    colors[3].name= "BLACK";
    colors[3].redValue = 1.0;
    colors[3].greenValue = 1.0;
    colors[3].blueValue = 1.0;
    
    colors[4].name= "WHITE";
    colors[4].redValue = 0.0;
    colors[4].greenValue = 0.0;
    colors[4].blueValue = 0.0;
    
    colors[5].name = "ORANGE";
    colors[5].redValue = 0.0;
    colors[5].greenValue = 0.0;
    colors[5].blueValue = 1.0;
    
    colors[6].name = "MAGENTA";
    colors[6].redValue = 0.0;
    colors[6].greenValue = 1.0;
    colors[6].blueValue = 0.0;
    
    colors[7].name = "CYAN";
    colors[7].redValue = 1.0;
    colors[7].greenValue = 0.0;
    colors[7].blueValue = 0.0;
}

                
led::COLOR led::getCOLOR(char *n){
    led::COLOR temp;
    for(int i=0;i<count;i++){
        if(strcmp(colors[i].name,n) ==0){
            temp =colors[i];
            break;
        }
    }
    return temp;
}