sample test program with Mx64
Dependencies: C12832_lcd MX64 SerialHalfDuplex mbed
main.cpp@1:d0d0678ac9da, 2014-06-27 (annotated)
- Committer:
- ppr2013G2
- Date:
- Fri Jun 27 04:37:35 2014 +0000
- Revision:
- 1:d0d0678ac9da
- Parent:
- 0:782e99c3f9fd
remove function;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ppr2013G2 | 0:782e99c3f9fd | 1 | #include "mbed.h" |
ppr2013G2 | 0:782e99c3f9fd | 2 | #include "MX64.h" |
ppr2013G2 | 0:782e99c3f9fd | 3 | #include "C12832_lcd.h" |
ppr2013G2 | 0:782e99c3f9fd | 4 | |
ppr2013G2 | 0:782e99c3f9fd | 5 | AnalogIn pot1(p19); |
ppr2013G2 | 0:782e99c3f9fd | 6 | C12832_LCD lcd; |
ppr2013G2 | 0:782e99c3f9fd | 7 | |
ppr2013G2 | 0:782e99c3f9fd | 8 | |
ppr2013G2 | 0:782e99c3f9fd | 9 | int main() |
ppr2013G2 | 0:782e99c3f9fd | 10 | { |
ppr2013G2 | 0:782e99c3f9fd | 11 | MX64 mymx64 (p9, p10, 22); //for LPC1768 |
ppr2013G2 | 0:782e99c3f9fd | 12 | int deg; |
ppr2013G2 | 0:782e99c3f9fd | 13 | while (1) { |
ppr2013G2 | 0:782e99c3f9fd | 14 | lcd.cls();//clear screen |
ppr2013G2 | 0:782e99c3f9fd | 15 | lcd.locate(40,3);//set locate |
ppr2013G2 | 0:782e99c3f9fd | 16 | lcd.printf("!Hello Mx64!"); |
ppr2013G2 | 0:782e99c3f9fd | 17 | lcd.line(0, 13, 128, 13, 1);//draw a line |
ppr2013G2 | 1:d0d0678ac9da | 18 | deg=(int)(pot1*360); |
ppr2013G2 | 0:782e99c3f9fd | 19 | lcd.locate(0,15);//set locate |
ppr2013G2 | 0:782e99c3f9fd | 20 | lcd.printf("Pos:%g,Temp:%g,Volt%g",mymx64.GetPosition(),mymx64.GetTemp(),mymx64.GetVolts()); |
ppr2013G2 | 0:782e99c3f9fd | 21 | mymx64.SetGoal(deg); // set mx64 go to deg |
ppr2013G2 | 0:782e99c3f9fd | 22 | wait(0.1); |
ppr2013G2 | 0:782e99c3f9fd | 23 | } |
ppr2013G2 | 0:782e99c3f9fd | 24 | } |