sample test program with Ax12

Dependencies:   AX12 C12832_lcd SerialHalfDuplex mbed

Committer:
ppr2013G2
Date:
Fri Jun 27 04:33:26 2014 +0000
Revision:
1:58dae564e9ff
Parent:
0:0069ce266807
remove function

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ppr2013G2 0:0069ce266807 1 #include "mbed.h"
ppr2013G2 0:0069ce266807 2 #include "AX12.h"
ppr2013G2 0:0069ce266807 3 #include "C12832_lcd.h"
ppr2013G2 0:0069ce266807 4
ppr2013G2 0:0069ce266807 5 AnalogIn pot1(p19);
ppr2013G2 0:0069ce266807 6 C12832_LCD lcd;
ppr2013G2 0:0069ce266807 7
ppr2013G2 0:0069ce266807 8
ppr2013G2 0:0069ce266807 9 int main()
ppr2013G2 0:0069ce266807 10 {
ppr2013G2 0:0069ce266807 11 AX12 myax12 (p9, p10, 2); //for LPC1768
ppr2013G2 0:0069ce266807 12 int deg;
ppr2013G2 0:0069ce266807 13 while (1) {
ppr2013G2 0:0069ce266807 14 lcd.cls();//clear screen
ppr2013G2 0:0069ce266807 15 lcd.locate(40,3);//set locate
ppr2013G2 0:0069ce266807 16 lcd.printf("!Hello Ax12!");
ppr2013G2 0:0069ce266807 17 lcd.line(0, 13, 128, 13, 1);//draw a line
ppr2013G2 1:58dae564e9ff 18 deg=(int)(pot1*300);
ppr2013G2 0:0069ce266807 19 lcd.locate(0,15);//set locate
ppr2013G2 0:0069ce266807 20 lcd.printf("Pos:%g,Temp:%g,Volt%g",myax12.GetPosition(),myax12.GetTemp(),myax12.GetVolts());
ppr2013G2 0:0069ce266807 21 myax12.SetGoal(deg); // set ax12 go to deg
ppr2013G2 0:0069ce266807 22 wait(0.1);
ppr2013G2 0:0069ce266807 23 }
ppr2013G2 0:0069ce266807 24 }