Part One of my Project Course. Implementation of simple I/O and a custom defined protocol over UDP/IP.

Dependencies:   C12832 LM75B mbed EthernetInterface mbed-rtos

rgb.cpp

Committer:
bertgereels
Date:
2018-02-26
Revision:
0:88d3b9015f7c
Child:
1:b5c534165dfe

File content as of revision 0:88d3b9015f7c:

#include "mbed.h"
#include "rgb.h"

namespace ProjectOne{
    
    const float RGB::r_values[] = {0.0, 1.0, 1.0, 0.0, 0.498, 0.0, 1.0};
    const float RGB::g_values[] = {1.0, 0.0, 1.0, 0.353, 1.0, 0.0, 1.0};
    const float RGB::b_values[] = {1.0, 1.0, 0.0, 1.0, 0.498, 0.0, 1.0};
    
    RGB::RGB(PinName r_pin, PinName g_pin, PinName b_pin) : r(r_pin), g(g_pin), b(b_pin){
    
    }
    
    //Rood = 0, Groen = 1, Blauw = 2, Oranje = 3, Paars = 4, Wit = 5, Uit = 6
    void RGB::turnOnLed(int kleur){
        r = r_values[kleur];
        g = g_values[kleur];
        b = b_values[kleur];
    }
    
}