Soccer Penalty Kick Game
Introduction: Soccer Penalty Kick Game
This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida ()
This is a two player game in which one player controls the goalie to go back and forth between the goal posts as the second player attempts to score the mini soccer goal in the net.
Step 1: Files Needed:
Step 2: 3D Parts and Setup:
For the 3D printing you need to print 2 of "Goal post1" and "Goal post2". The four posts should fit snug into the holes provided on the base. It may help to stuff part of the net used for the goal into the holes before putting the posts in so that its easier to create more tension within the netting.
For the goalie itself, all i did was super glue the arm of the Servo motor to the stem and then attached it through the slit of the base. On the bottom of the base there is a housing that holds the Servo motor in perfect position.
Also minor sanding may be needed on all parts.
Step 3: Equipment Needed:
- Arduino Uno
- breadboard
- Servo motor
- IR remote
- IR reciever
Step 4: Setup:
Pin 11 is connected to the IR receiver and Pin 9 is connected to the Servo motor. Both devices are also hooked up to the appropriate ground and 5V pins.
Step 5: Main Code:
#include <IRremote.h>
#include <Servo.h>
#define servopin 9
int Pulse_Width=0;
int RECV_PIN=11;
int pos;
IRrecv irrecv(RECV_PIN);
decode_results results;
Servo myservo;
void setup() {
Serial.begin(9600);
myservo.attach(servopin);
irrecv.enableIRIn(); // Start the receiver
}
void loop() {
if (irrecv.decode(&results)) {//has a transmission been received?
Serial.println(results.value);//If yes: interpret the received commands...
if (results.value == 16754775){
pos=myservo.read();
myservo.write(pos+10);
}
if (results.value == 16769055){
pos=myservo.read();
myservo.write(pos-10);
}
if (results.value == 16724175){
sweep();
}
irrecv.resume(); // Receive the next value
}
}
Step 6: Function Code:
void sweep () {
for(int x=1; x<5; x++){
for (pos = 55; pos <= 125; pos += 1) { // goes from 0 degrees to 180 degrees in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
for (pos = 125; pos >= 55; pos -= 1) { // goes from 180 degrees to 0 degrees
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
}
}
Step 7:
Make sure to have the Main code and the Function code is two seperate files, but both files need to be in the same folder for it to work
to control the goalie use the plus minus on the IR remote to move the goalie left and right
Looks like fun :)