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.
Fork of 4180lab2_part7_Servo by
Revision 2:8b44ababac65, committed 2015-09-05
- Comitter:
- ycai47
- Date:
- Sat Sep 05 22:50:17 2015 +0000
- Parent:
- 1:40d2fd0b99e6
- Commit message:
- servo
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 40d2fd0b99e6 -r 8b44ababac65 main.cpp
--- a/main.cpp Tue Nov 23 16:10:35 2010 +0000
+++ b/main.cpp Sat Sep 05 22:50:17 2015 +0000
@@ -3,11 +3,14 @@
#include "mbed.h"
#include "Servo.h"
+AnalogIn pot(p20);
Servo myservo(p21);
-int main() {
- for(float p=0; p<1.0; p += 0.1) {
- myservo = p;
- wait(0.2);
+int main() {
+ while (true)
+ {
+ float vol = pot.read();
+ myservo.write(vol);
+ wait(0.02f);
}
}
