This is a simple demo which is the solution for Lab 2

Dependencies:   C12832 mbed

Fork of app-shield-LCD by Chris Styles

Files at this revision

API Documentation at this revision

Comitter:
JimCarver
Date:
Sat Sep 13 21:54:03 2014 +0000
Parent:
6:f8ef5e45e488
Child:
8:e95a2d548737
Commit message:
Example program for EBV

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- 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);
     }
 }