Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 #include "mbed.h" 00002 #include "Servo.h" 00003 00004 Servo myservo(D9); 00005 Serial esp8266(D6, D7); 00006 Serial pc(USBTX, USBRX); 00007 00008 int main() { 00009 printf("Servo Calibration Controls:\n"); 00010 printf("1,2,3 - Position Servo (full left, middle, full right)\n"); 00011 printf("4,5 - Decrease or Increase range\n"); 00012 00013 float range = 0.0005; 00014 float position = 0.5; 00015 00016 while(1) { 00017 switch(esp8266.getc()) { 00018 case '1': position = 0.0; break; 00019 case '2': position = 0.5; break; 00020 case '3': position = 1.0; break; 00021 case '4': range += 0.0002f; break; 00022 case '5': range -= 0.0002f; break; 00023 } 00024 printf("position = %.1f, range = +/-%0.4f\n", position, range); 00025 myservo.calibrate(range, 45.0); 00026 myservo = position; 00027 } 00028 }
Generated on Thu Aug 18 2022 07:42:47 by
1.7.2