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.
Revision 2:2e55f8c4e259, committed 2017-02-03
- Comitter:
- odb
- Date:
- Fri Feb 03 08:04:53 2017 +0000
- Parent:
- 1:40d2fd0b99e6
- Commit message:
- CORE-1000 First
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Nov 23 16:10:35 2010 +0000 +++ b/main.cpp Fri Feb 03 08:04:53 2017 +0000 @@ -1,9 +1,40 @@ +#include "mbed.h" +#include "Servo.h" + +Servo myservo(PB_13); +Serial pc(USBTX, USBRX); + +int main() { + printf("Servo Calibration Controls:\r\n"); + printf("1,2,3 - Position Servo (full left, middle, full right)\r\n"); + printf("4,5 - Decrease or Increase range\r\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; + } + printf("position = %.1f, range = +/-%0.4f\r\n", position, range); + myservo.calibrate(range, 45.0); + myservo = position; + } +} + + +/* test + // Hello World to sweep a servo through its full range #include "mbed.h" #include "Servo.h" -Servo myservo(p21); +Servo myservo(PA_15); int main() { for(float p=0; p<1.0; p += 0.1) { @@ -11,3 +42,4 @@ wait(0.2); } } +*/ \ No newline at end of file
--- a/mbed.bld Tue Nov 23 16:10:35 2010 +0000 +++ b/mbed.bld Fri Feb 03 08:04:53 2017 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/e2ac27c8e93e +http://mbed.org/users/mbed_official/code/mbed/builds/082adc85693f \ No newline at end of file