sample test program with Mx64
Dependencies: C12832_lcd MX64 SerialHalfDuplex mbed
Revision 1:d0d0678ac9da, committed 2014-06-27
- Comitter:
- ppr2013G2
- Date:
- Fri Jun 27 04:37:35 2014 +0000
- Parent:
- 0:782e99c3f9fd
- Commit message:
- remove function;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 782e99c3f9fd -r d0d0678ac9da main.cpp --- a/main.cpp Fri Jun 20 06:34:51 2014 +0000 +++ b/main.cpp Fri Jun 27 04:37:35 2014 +0000 @@ -5,14 +5,6 @@ AnalogIn pot1(p19); C12832_LCD lcd; -/*******************************/ -/********mapping function*******/ -/*convert old range to new range*/ -/*******************************/ -double map(double val, double b_min, double b_max, double a_min, double a_max) -{ - return (val - b_max) * (a_min - a_max) / (b_min - b_max) + a_max; -} int main() { @@ -23,7 +15,7 @@ lcd.locate(40,3);//set locate lcd.printf("!Hello Mx64!"); lcd.line(0, 13, 128, 13, 1);//draw a line - deg=(int)map(pot1*100.0, 0.0, 100.0, 0.0, 360.0 );//convert range + deg=(int)(pot1*360); lcd.locate(0,15);//set locate lcd.printf("Pos:%g,Temp:%g,Volt%g",mymx64.GetPosition(),mymx64.GetTemp(),mymx64.GetVolts()); mymx64.SetGoal(deg); // set mx64 go to deg