This is a simple demo which is the solution for Lab 2
Fork of app-shield-LCD by
Diff: main.cpp
- Revision:
- 7:5c3616aaa642
- Parent:
- 4:39c7c31b8fb0
- Child:
- 8:e95a2d548737
--- a/main.cpp Fri Aug 01 14:30:24 2014 +0000 +++ b/main.cpp Sat Sep 13 21:54:03 2014 +0000 @@ -3,18 +3,30 @@ // Using Arduino pin notation C12832 lcd(D11, D13, D12, D7, D10); +AnalogIn pot1(A0); +AnalogIn pot2(A1); +PwmOut red(D5); +PwmOut green(D9); + int main() { int j=0; + float a1, a2; + red.period_ms(4); + green.period_ms(4); lcd.cls(); lcd.locate(0,3); lcd.printf("mbed application shield!"); while(true) { // this is the third thread + a1 = pot1.read(); + a2 = pot2.read(); lcd.locate(0,15); - lcd.printf("Counting : %d",j); + lcd.printf("POT1=%1.3f POT2=%1.3f",a1, a2); + red.write(a1); + green.write(a2); j++; - wait(1.0); + wait(0.1); } }