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 //To plot with usb, set as below. 00005 Serial pc(USBTX,USBRX); // Tx, Rx Pin 00006 00007 //Set each gpio to control servo 00008 Servo servo (p10); 00009 00010 // Align servo 00011 int main() 00012 { 00013 float degree = 0.0; 00014 pc.printf("Waiting Request\n"); 00015 servo.update (0.0); 00016 00017 pc.printf("Degree: %f\n", servo.getDegree()); 00018 while(1) { 00019 char c = pc.getc(); 00020 00021 if (c == 'u') degree += 0.5; 00022 else if (c == 'd') degree -= 0.5; 00023 00024 servo.update (degree); 00025 degree = servo.getDegree(); 00026 pc.printf("Degree: %f\n", degree); 00027 } 00028 }
Generated on Tue Jul 12 2022 23:31:46 by
1.7.2