
rgb
Revision 4:1f114c172d80, committed 2020-02-10
- Comitter:
- timonclaerhout
- Date:
- Mon Feb 10 10:16:36 2020 +0000
- Parent:
- 3:29cbc33e1a7f
- Commit message:
- rgb;
Changed in this revision
C12832.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C12832.lib Mon Feb 10 10:16:36 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/askksa12543/code/C12832/#990d5eec2ef6
--- a/main.cpp Tue Sep 19 19:33:26 2017 +0000 +++ b/main.cpp Mon Feb 10 10:16:36 2020 +0000 @@ -1,19 +1,34 @@ #include "mbed.h" +#include "C12832.h" + + +// Blinking rate in milliseconds +#define BLINKING_RATE_MS 500 + +C12832 lcd(D11, D13, D12, D7, D10); +AnalogIn pot1 (A0); +AnalogIn pot2 (A1); PwmOut r (D5); PwmOut g (D8); PwmOut b (D9); + int main() { - r.period(0.001); - while(1) { - for(float i = 0.0; i < 1.0 ; i += 0.001) { - float p = 3 * i; - r = 1.0 - ((p < 1.0) ? 1.0 - p : (p > 2.0) ? p - 2.0 : 0.0); - g = 1.0 - ((p < 1.0) ? p : (p > 2.0) ? 0.0 : 2.0 - p); - b = 1.0 - ((p < 1.0) ? 0.0 : (p > 2.0) ? 3.0 - p : p - 1.0); ; - wait (0.01); - } - } + lcd.cls(); + while(1) { + + lcd.locate(0,3); + lcd.printf("Pot 1 = %.2f", (float)pot1); + lcd.locate(0,14); + lcd.printf("Pot 2 = %.2f", (float)pot2); + + + r = (float)pot1; + g = (float)pot1; + b = (float)pot2; ; + wait (0.1); + } + } \ No newline at end of file