Zhen Liu
/
HW2_P6
problem 6 for HW 2
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 |
diff -r 40d2fd0b99e6 -r 184c8630e678 main.cpp --- 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); + } }