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@0:88d3b9015f7c, 2018-02-26 (annotated)
- Committer:
- bertgereels
- Date:
- Mon Feb 26 11:25:59 2018 +0000
- Revision:
- 0:88d3b9015f7c
- Child:
- 1:b5c534165dfe
First Commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bertgereels | 0:88d3b9015f7c | 1 | #include "mbed.h" |
bertgereels | 0:88d3b9015f7c | 2 | #include "rgb.h" |
bertgereels | 0:88d3b9015f7c | 3 | |
bertgereels | 0:88d3b9015f7c | 4 | namespace ProjectOne{ |
bertgereels | 0:88d3b9015f7c | 5 | |
bertgereels | 0:88d3b9015f7c | 6 | const float RGB::r_values[] = {0.0, 1.0, 1.0, 0.0, 0.498, 0.0, 1.0}; |
bertgereels | 0:88d3b9015f7c | 7 | const float RGB::g_values[] = {1.0, 0.0, 1.0, 0.353, 1.0, 0.0, 1.0}; |
bertgereels | 0:88d3b9015f7c | 8 | const float RGB::b_values[] = {1.0, 1.0, 0.0, 1.0, 0.498, 0.0, 1.0}; |
bertgereels | 0:88d3b9015f7c | 9 | |
bertgereels | 0:88d3b9015f7c | 10 | RGB::RGB(PinName r_pin, PinName g_pin, PinName b_pin) : r(r_pin), g(g_pin), b(b_pin){ |
bertgereels | 0:88d3b9015f7c | 11 | |
bertgereels | 0:88d3b9015f7c | 12 | } |
bertgereels | 0:88d3b9015f7c | 13 | |
bertgereels | 0:88d3b9015f7c | 14 | //Rood = 0, Groen = 1, Blauw = 2, Oranje = 3, Paars = 4, Wit = 5, Uit = 6 |
bertgereels | 0:88d3b9015f7c | 15 | void RGB::turnOnLed(int kleur){ |
bertgereels | 0:88d3b9015f7c | 16 | r = r_values[kleur]; |
bertgereels | 0:88d3b9015f7c | 17 | g = g_values[kleur]; |
bertgereels | 0:88d3b9015f7c | 18 | b = b_values[kleur]; |
bertgereels | 0:88d3b9015f7c | 19 | } |
bertgereels | 0:88d3b9015f7c | 20 | |
bertgereels | 0:88d3b9015f7c | 21 | } |
bertgereels | 0:88d3b9015f7c | 22 | |
bertgereels | 0:88d3b9015f7c | 23 |