Code for the High Five Portion of the game

Dependencies:   Servo mbed

Fork of Guntrigger by Fa2018-es200-3321-proj2-WHACK_A_MOLE

Committer:
vinnypotente
Date:
Wed Oct 10 14:43:42 2018 +0000
Revision:
1:a1880f0b0f04
Parent:
0:e65fc2ec46d6
Child:
2:629e8eb2c308
This is the High Five Code

Who changed what in which revision?

UserRevisionLine numberNew contents of line
vinnypotente 0:e65fc2ec46d6 1 #include "mbed.h"
vinnypotente 0:e65fc2ec46d6 2 #include "Servo.h"
vinnypotente 0:e65fc2ec46d6 3
vinnypotente 0:e65fc2ec46d6 4 Servo myservo(p21);
vinnypotente 0:e65fc2ec46d6 5 float pos;
vinnypotente 0:e65fc2ec46d6 6 char c;
vinnypotente 0:e65fc2ec46d6 7 int main()
vinnypotente 0:e65fc2ec46d6 8 {
vinnypotente 0:e65fc2ec46d6 9 myservo.calibrate(0.0009,90.0);
vinnypotente 0:e65fc2ec46d6 10 myservo=0.0;
vinnypotente 0:e65fc2ec46d6 11 wait(1);
vinnypotente 0:e65fc2ec46d6 12 while (1) {
vinnypotente 0:e65fc2ec46d6 13 c = getchar ();
vinnypotente 1:a1880f0b0f04 14 for (pos =0.0; pos<=50.0; pos=pos+10.0) {
vinnypotente 1:a1880f0b0f04 15 myservo=(pos/50.0);
vinnypotente 0:e65fc2ec46d6 16 wait (0.07);
vinnypotente 0:e65fc2ec46d6 17 printf("%f\n",pos);
vinnypotente 0:e65fc2ec46d6 18 }
vinnypotente 1:a1880f0b0f04 19 wait(2.0);
vinnypotente 1:a1880f0b0f04 20 for (pos =50.0; pos>=0.0; pos=pos-10.0) {
vinnypotente 1:a1880f0b0f04 21 myservo=(pos/50.0);
vinnypotente 0:e65fc2ec46d6 22 wait (0.07);
vinnypotente 0:e65fc2ec46d6 23 printf("%f\n",pos);
vinnypotente 0:e65fc2ec46d6 24 }
vinnypotente 0:e65fc2ec46d6 25 }
vinnypotente 0:e65fc2ec46d6 26 }