Build upon app-board-Servo. Print servo readings, scaled to [0.0, 1.0], to LCD on mbed Application Board. Scale reading to [0 - 270] range of typical servo. Print servo angles to LCD on mbed Application Board.
Dependencies: C12832_lcd Servo mbed
Fork of app-board-Servo by
Revision 5:d751707daaf7, committed 2013-10-08
- Comitter:
- chapfohn
- Date:
- Tue Oct 08 11:07:07 2013 +0000
- Parent:
- 4:62b61875eab5
- Commit message:
- Setup as two-way table.; All cells labelled.;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 62b61875eab5 -r d751707daaf7 main.cpp --- a/main.cpp Tue Oct 08 10:21:50 2013 +0000 +++ b/main.cpp Tue Oct 08 11:07:07 2013 +0000 @@ -35,23 +35,33 @@ TILTa = tiltT/n; //axis average over n lcd.cls(); //Clear screen for new cycle - lcd.locate(3,3); //Screen location - lcd.printf("pan"); //Column heading - lcd.locate(33,3); //Screen location - lcd.printf("|"); //column seperator - lcd.locate(51,3); //Screen location - lcd.printf("tilt"); //Column heading + lcd.locate(30,3); //Screen location + lcd.printf("|"); //column seperator + lcd.locate(43,3); //Screen location + lcd.printf("Pan"); //Column heading + lcd.locate(76,3); //Screen location + lcd.printf("|"); //column seperator + lcd.locate(91,3); //Screen location + lcd.printf("Tilt"); //Column heading lcd.locate(3,12); //Screen location + lcd.printf("Norm"); //column seperator + lcd.locate(30,12); //Screen location + lcd.printf("|"); //column seperator + lcd.locate(43,12); //Screen location lcd.printf("%.2f\n",PANa); //Print PAN - lcd.locate(33,12); //Screen location - lcd.printf("|"); //column seperator - lcd.locate(51,12); //Screen location + lcd.locate(76,12); //Screen location + lcd.printf("|"); //column seperator + lcd.locate(91,12); //Screen location lcd.printf("%.2f\n",TILTa); //Print TILT lcd.locate(3,21); //Screen location + lcd.printf("Angle"); //column seperator + lcd.locate(30,21); //Screen location + lcd.printf("|"); //column seperator + lcd.locate(43,21); //Screen location lcd.printf("%.2f\n",PANa*270); //Print PAN - lcd.locate(33,21); //Screen location - lcd.printf("|"); //column seperator - lcd.locate(51,21); //Screen location + lcd.locate(76,21); //Screen location + lcd.printf("|"); //column seperator + lcd.locate(91,21); //Screen location lcd.printf("%.2f\n",TILTa*270); //Print TILT s1=p1; //Set PAN servo to PAN potentiometer reading s2=p2; //Set PAN servo to PAN potentiometer reading