Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: m3Dpi MQTT-Thermostat-example Final_project_Tran Final_project_Tran ... more
RGB.h@4:a7a26506c62f, 2015-10-22 (annotated)
- Committer:
- sillevl
- Date:
- Thu Oct 22 17:17:13 2015 +0000
- Revision:
- 4:a7a26506c62f
- Parent:
- 2:ed46f45e1d66
- Child:
- 6:b5a88296bc50
code cleanup
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| sillevl | 0:9509f771054b | 1 | |
| sillevl | 0:9509f771054b | 2 | #include "mbed.h" |
| sillevl | 2:ed46f45e1d66 | 3 | #include "Color.h" |
| sillevl | 0:9509f771054b | 4 | |
| sillevl | 2:ed46f45e1d66 | 5 | #ifndef RGB_H |
| sillevl | 2:ed46f45e1d66 | 6 | #define RGB_H |
| sillevl | 0:9509f771054b | 7 | |
| sillevl | 4:a7a26506c62f | 8 | class RGB |
| sillevl | 4:a7a26506c62f | 9 | { |
| sillevl | 4:a7a26506c62f | 10 | public: |
| sillevl | 4:a7a26506c62f | 11 | |
| sillevl | 2:ed46f45e1d66 | 12 | static const int OFF = 0; |
| sillevl | 4:a7a26506c62f | 13 | |
| sillevl | 0:9509f771054b | 14 | RGB(PinName r_pin, PinName g_pin, PinName b_pin); |
| sillevl | 4:a7a26506c62f | 15 | ~RGB(); |
| sillevl | 0:9509f771054b | 16 | // void setIntensity(int intensity); // How are we gonna do this? |
| sillevl | 2:ed46f45e1d66 | 17 | void setColor(Color* color); |
| sillevl | 0:9509f771054b | 18 | void setColor(int color); |
| sillevl | 2:ed46f45e1d66 | 19 | Color* getColor(); |
| sillevl | 4:a7a26506c62f | 20 | |
| sillevl | 0:9509f771054b | 21 | // void on(); // do we need this? what value to turn on to? |
| sillevl | 0:9509f771054b | 22 | void off(); |
| sillevl | 4:a7a26506c62f | 23 | |
| sillevl | 4:a7a26506c62f | 24 | protected: |
| sillevl | 0:9509f771054b | 25 | //void setColor(int r, int g, int b); |
| sillevl | 4:a7a26506c62f | 26 | |
| sillevl | 4:a7a26506c62f | 27 | private: |
| sillevl | 0:9509f771054b | 28 | PwmOut* r_out; |
| sillevl | 0:9509f771054b | 29 | PwmOut* g_out; |
| sillevl | 0:9509f771054b | 30 | PwmOut* b_out; |
| sillevl | 4:a7a26506c62f | 31 | |
| sillevl | 2:ed46f45e1d66 | 32 | Color* color; |
| sillevl | 4:a7a26506c62f | 33 | |
| sillevl | 2:ed46f45e1d66 | 34 | void setPwmColor(int value, PwmOut* output); |
| sillevl | 4:a7a26506c62f | 35 | |
| sillevl | 0:9509f771054b | 36 | }; |
| sillevl | 2:ed46f45e1d66 | 37 | |
| sillevl | 2:ed46f45e1d66 | 38 | #endif |