Jens Cocquyt
/
PotRGB
main.cpp@7:c2caf3cc5d19, 2020-02-10 (annotated)
- Committer:
- jens_c
- Date:
- Mon Feb 10 10:25:24 2020 +0000
- Revision:
- 7:c2caf3cc5d19
- Parent:
- 6:f8cb706c480c
works
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dreschpe | 0:f6a57b843f79 | 1 | #include "mbed.h" |
chris | 3:2db94ee076ee | 2 | #include "C12832.h" |
dreschpe | 0:f6a57b843f79 | 3 | |
chris | 4:39c7c31b8fb0 | 4 | // Using Arduino pin notation |
chris | 4:39c7c31b8fb0 | 5 | C12832 lcd(D11, D13, D12, D7, D10); |
jens_c | 7:c2caf3cc5d19 | 6 | PwmOut r (D5); |
jens_c | 7:c2caf3cc5d19 | 7 | PwmOut g (D8); |
jens_c | 7:c2caf3cc5d19 | 8 | PwmOut b (D9); |
jens_c | 7:c2caf3cc5d19 | 9 | AnalogIn pot1 (A0); |
jens_c | 7:c2caf3cc5d19 | 10 | AnalogIn pot2 (A1); |
dreschpe | 0:f6a57b843f79 | 11 | int main() |
dreschpe | 0:f6a57b843f79 | 12 | { |
jens_c | 7:c2caf3cc5d19 | 13 | |
chris | 2:a87e255a8f3a | 14 | int j=0; |
dreschpe | 0:f6a57b843f79 | 15 | |
dreschpe | 0:f6a57b843f79 | 16 | while(true) { // this is the third thread |
jens_c | 7:c2caf3cc5d19 | 17 | lcd.cls(); |
jens_c | 7:c2caf3cc5d19 | 18 | lcd.locate(0,3); |
jens_c | 7:c2caf3cc5d19 | 19 | lcd.printf("Pot 1 = %.2f", (float)pot1); |
jens_c | 7:c2caf3cc5d19 | 20 | lcd.locate(0,14); |
jens_c | 7:c2caf3cc5d19 | 21 | lcd.printf("Pot 2 = %.2f", (float)pot2); |
jens_c | 7:c2caf3cc5d19 | 22 | wait(0.1); |
jens_c | 7:c2caf3cc5d19 | 23 | r = pot1; |
jens_c | 7:c2caf3cc5d19 | 24 | g = pot2; |
dreschpe | 0:f6a57b843f79 | 25 | } |
dreschpe | 0:f6a57b843f79 | 26 | } |