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

Dependencies:   C12832 mbed

Fork of app-shield-LCD by Chris Styles

Committer:
JimCarver
Date:
Mon Sep 15 14:55:56 2014 +0000
Revision:
8:e95a2d548737
Parent:
7:5c3616aaa642
xx

Who changed what in which revision?

UserRevisionLine numberNew 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
JimCarver 8:e95a2d548737 12
dreschpe 0:f6a57b843f79 13 int main()
dreschpe 0:f6a57b843f79 14 {
chris 2:a87e255a8f3a 15 int j=0;
JimCarver 7:5c3616aaa642 16 float a1, a2;
JimCarver 7:5c3616aaa642 17 red.period_ms(4);
JimCarver 7:5c3616aaa642 18 green.period_ms(4);
chris 2:a87e255a8f3a 19 lcd.cls();
chris 2:a87e255a8f3a 20 lcd.locate(0,3);
chris 4:39c7c31b8fb0 21 lcd.printf("mbed application shield!");
dreschpe 0:f6a57b843f79 22
dreschpe 0:f6a57b843f79 23 while(true) { // this is the third thread
JimCarver 7:5c3616aaa642 24 a1 = pot1.read();
JimCarver 7:5c3616aaa642 25 a2 = pot2.read();
chris 2:a87e255a8f3a 26 lcd.locate(0,15);
JimCarver 7:5c3616aaa642 27 lcd.printf("POT1=%1.3f POT2=%1.3f",a1, a2);
JimCarver 7:5c3616aaa642 28 red.write(a1);
JimCarver 7:5c3616aaa642 29 green.write(a2);
chris 2:a87e255a8f3a 30 j++;
JimCarver 7:5c3616aaa642 31 wait(0.1);
dreschpe 0:f6a57b843f79 32 }
dreschpe 0:f6a57b843f79 33 }