Fa2018-es200-3321-proj2-WHACK_A_MOLE
/
HighFiveCode
Code for the High Five Portion of the game
Fork of Guntrigger by
Revision 2:629e8eb2c308, committed 2018-10-15
- Comitter:
- vinnypotente
- Date:
- Mon Oct 15 13:55:27 2018 +0000
- Parent:
- 1:a1880f0b0f04
- Commit message:
- added the comments
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r a1880f0b0f04 -r 629e8eb2c308 main.cpp --- a/main.cpp Wed Oct 10 14:43:42 2018 +0000 +++ b/main.cpp Mon Oct 15 13:55:27 2018 +0000 @@ -1,7 +1,7 @@ #include "mbed.h" #include "Servo.h" - -Servo myservo(p21); + +Servo myservo(p22); float pos; char c; int main() @@ -11,14 +11,20 @@ wait(1); while (1) { c = getchar (); - for (pos =0.0; pos<=50.0; pos=pos+10.0) { - myservo=(pos/50.0); + for (pos =0.0; pos<=40.0; pos=pos+10.0) { + myservo=(pos/90.0); wait (0.07); printf("%f\n",pos); } - wait(2.0); - for (pos =50.0; pos>=0.0; pos=pos-10.0) { - myservo=(pos/50.0); + wait(1.0); //shows the hand + for (pos =40.0; pos>=60.0; pos=pos+10.0) { + myservo=(pos/90.0); + wait (0.07); + printf("%f\n",pos); + } + wait (1.0); // moves hand forward to hit users hand + for (pos =60.0; pos>=0.0; pos=pos-10.0) { + myservo=(pos/90.0); wait (0.07); printf("%f\n",pos); }