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 Servo_HelloWorld by
Revision 2:184c8630e678, committed 2015-02-18
- Comitter:
- lzzcd001
- Date:
- Wed Feb 18 14:52:18 2015 +0000
- Parent:
- 1:40d2fd0b99e6
- Commit message:
- problem 6 for HW 2
Changed in this revision
| main.cpp | 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 Wed Feb 18 14:52:18 2015 +0000
@@ -6,8 +6,22 @@
Servo myservo(p21);
int main() {
- for(float p=0; p<1.0; p += 0.1) {
+ //for(float p=0; p<1.0; p += 0.1) {
+ // myservo = p;
+ // wait(0.2);
+ //}
+ for(float p=0; p<1; p += 0.1) {
myservo = p;
wait(0.2);
}
+ for(float p=1; p>0; p -= 0.1) {
+ myservo = p;
+ wait(0.2);
+ }
+ for(float p=0.2; p<0.8; p += 0.1) {
+ myservo = p+0.05;
+ wait(0.2);
+ myservo = p-0.05;
+ wait(0.2);
+ }
}
