Fa2018-es200-3321-proj2-WHACK_A_MOLE
/
HighFiveCode
Code for the High Five Portion of the game
Fork of Guntrigger by
main.cpp
- Committer:
- vinnypotente
- Date:
- 2018-10-15
- Revision:
- 2:629e8eb2c308
- Parent:
- 1:a1880f0b0f04
File content as of revision 2:629e8eb2c308:
#include "mbed.h" #include "Servo.h" Servo myservo(p22); float pos; char c; int main() { myservo.calibrate(0.0009,90.0); myservo=0.0; wait(1); while (1) { c = getchar (); for (pos =0.0; pos<=40.0; pos=pos+10.0) { myservo=(pos/90.0); wait (0.07); printf("%f\n",pos); } 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); } } }