This is a simple demo which is the solution for Lab 2
Fork of app-shield-LCD by
main.cpp@7:5c3616aaa642, 2014-09-13 (annotated)
- Committer:
- JimCarver
- Date:
- Sat Sep 13 21:54:03 2014 +0000
- Revision:
- 7:5c3616aaa642
- Parent:
- 4:39c7c31b8fb0
- Child:
- 8:e95a2d548737
Example program for EBV
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); |
JimCarver | 7:5c3616aaa642 | 6 | AnalogIn pot1(A0); |
JimCarver | 7:5c3616aaa642 | 7 | AnalogIn pot2(A1); |
JimCarver | 7:5c3616aaa642 | 8 | PwmOut red(D5); |
JimCarver | 7:5c3616aaa642 | 9 | PwmOut green(D9); |
JimCarver | 7:5c3616aaa642 | 10 | |
dreschpe | 1:1c6a9eaf55b5 | 11 | |
dreschpe | 0:f6a57b843f79 | 12 | int main() |
dreschpe | 0:f6a57b843f79 | 13 | { |
chris | 2:a87e255a8f3a | 14 | int j=0; |
JimCarver | 7:5c3616aaa642 | 15 | float a1, a2; |
JimCarver | 7:5c3616aaa642 | 16 | red.period_ms(4); |
JimCarver | 7:5c3616aaa642 | 17 | green.period_ms(4); |
chris | 2:a87e255a8f3a | 18 | lcd.cls(); |
chris | 2:a87e255a8f3a | 19 | lcd.locate(0,3); |
chris | 4:39c7c31b8fb0 | 20 | lcd.printf("mbed application shield!"); |
dreschpe | 0:f6a57b843f79 | 21 | |
dreschpe | 0:f6a57b843f79 | 22 | while(true) { // this is the third thread |
JimCarver | 7:5c3616aaa642 | 23 | a1 = pot1.read(); |
JimCarver | 7:5c3616aaa642 | 24 | a2 = pot2.read(); |
chris | 2:a87e255a8f3a | 25 | lcd.locate(0,15); |
JimCarver | 7:5c3616aaa642 | 26 | lcd.printf("POT1=%1.3f POT2=%1.3f",a1, a2); |
JimCarver | 7:5c3616aaa642 | 27 | red.write(a1); |
JimCarver | 7:5c3616aaa642 | 28 | green.write(a2); |
chris | 2:a87e255a8f3a | 29 | j++; |
JimCarver | 7:5c3616aaa642 | 30 | wait(0.1); |
dreschpe | 0:f6a57b843f79 | 31 | } |
dreschpe | 0:f6a57b843f79 | 32 | } |