Koutarou Yabe
/
Servo_unlock
servo unlock
Fork of Servo_HelloWorld by
Revision 3:e80efe31284d, committed 2017-03-14
- Comitter:
- dll7
- Date:
- Tue Mar 14 23:32:33 2017 +0000
- Parent:
- 2:dd5776c8594d
- Child:
- 4:ea67df2060cd
- Commit message:
- CalibrationTool;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Mar 13 03:30:40 2017 +0000 +++ b/main.cpp Tue Mar 14 23:32:33 2017 +0000 @@ -19,9 +19,25 @@ } int main() { - printf("start"); - servo.calibrate(0.0005, 45.0); - button.mode(PullDown); - button.rise(&rise); - button.fall(&fall); + printf("Servo Calibration Controls:\n"); + printf("1,2,3 - Position Servo (full left, middle, full right)\n"); + printf("4,5 - Decrease or Increase range\n"); + + float range = 0.0005; + float position = 0.5; + + while(1) { + switch(pc.getc()) { + case '1': position = 0.0; break; + case '2': position = 0.5; break; + case '3': position = 1.0; break; + case '4': range += 0.0001; break; + case '5': range -= 0.0001; break; + case '6': position += 0.1; break; + case '7': position -= 0.1; break; + } + printf("position = %.1f, range = +/-%0.4f\n", position, range); + servo.calibrate(range, 45.0); + servo = position; + } }