![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
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.h@3:538e17979246, 2018-03-23 (annotated)
- Committer:
- bertgereels
- Date:
- Fri Mar 23 13:42:13 2018 +0000
- Revision:
- 3:538e17979246
- Parent:
- 2:6bfe732ba6bc
Cleared response array before constructing ack.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bertgereels | 0:88d3b9015f7c | 1 | #pragma once |
bertgereels | 0:88d3b9015f7c | 2 | |
bertgereels | 0:88d3b9015f7c | 3 | #include "mbed.h" |
bertgereels | 1:b5c534165dfe | 4 | #include <string> |
bertgereels | 0:88d3b9015f7c | 5 | |
bertgereels | 0:88d3b9015f7c | 6 | #define MAX_ARRAY_LENGTH_RGB 7 |
bertgereels | 0:88d3b9015f7c | 7 | |
bertgereels | 0:88d3b9015f7c | 8 | namespace ProjectOne{ |
bertgereels | 0:88d3b9015f7c | 9 | |
bertgereels | 0:88d3b9015f7c | 10 | class RGB{ |
bertgereels | 0:88d3b9015f7c | 11 | public: |
bertgereels | 2:6bfe732ba6bc | 12 | /* |
bertgereels | 2:6bfe732ba6bc | 13 | * Constructor for RGB class. |
bertgereels | 2:6bfe732ba6bc | 14 | * |
bertgereels | 2:6bfe732ba6bc | 15 | @param The pins that are connected to the RGB on the application board. |
bertgereels | 2:6bfe732ba6bc | 16 | @return Nothing. |
bertgereels | 2:6bfe732ba6bc | 17 | */ |
bertgereels | 0:88d3b9015f7c | 18 | RGB(PinName firstPin=p23, PinName secondPin=p24, PinName thirdPin=p25); |
bertgereels | 2:6bfe732ba6bc | 19 | |
bertgereels | 2:6bfe732ba6bc | 20 | /* |
bertgereels | 2:6bfe732ba6bc | 21 | * Method turns on the LED according to the given color. |
bertgereels | 2:6bfe732ba6bc | 22 | * |
bertgereels | 2:6bfe732ba6bc | 23 | @param A string containing the color to be displayed. |
bertgereels | 2:6bfe732ba6bc | 24 | @return Nothing. |
bertgereels | 2:6bfe732ba6bc | 25 | */ |
bertgereels | 1:b5c534165dfe | 26 | void turnOnLed(string kleur); |
bertgereels | 0:88d3b9015f7c | 27 | private: |
bertgereels | 0:88d3b9015f7c | 28 | const static float r_values[MAX_ARRAY_LENGTH_RGB]; |
bertgereels | 0:88d3b9015f7c | 29 | const static float g_values[MAX_ARRAY_LENGTH_RGB]; |
bertgereels | 0:88d3b9015f7c | 30 | const static float b_values[MAX_ARRAY_LENGTH_RGB]; |
bertgereels | 0:88d3b9015f7c | 31 | PwmOut r; |
bertgereels | 0:88d3b9015f7c | 32 | PwmOut g; |
bertgereels | 0:88d3b9015f7c | 33 | PwmOut b; |
bertgereels | 1:b5c534165dfe | 34 | int determineRgbIndex(string kleur); |
bertgereels | 0:88d3b9015f7c | 35 | }; |
bertgereels | 0:88d3b9015f7c | 36 | }; |