Introduction: Clown Putt Putt Game
This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida (www.makecourse.com) My inspiration came from the putt putt game in the movie Happy Gilmore I used an Arduino Uno, a metal gear servo, IR remote, IR receiver, and plenty of 3D printed parts.
Step 1: Design
Designing the components on Autocad inventor, I needed to make renderings of all the parts that I needed to print so first was the design aspect. The parts are in an attachment for viewing
Step 2: Arduino Code
This was the most strenous step for me because I am new to the C++ world.
i used the irremote library and also the servo library
#include
#include
int RECV_PIN = 11; // the pin where you connect the output pin of TSOP4838
int led1 = 10;
int itsONled[] = {0,0,0,0};
/* the initial state of LEDs is OFF (zero)
the first zero must remain zero but you can
change the others to 1's if you want a certain
led to light when the board is powered */
#define button1 0xFFA25D // code received from button A
Servo myservo;
int pos = 0;
int increment = 1;
long lastServoMove = 0;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup() {
Serial.begin(9600); // you can comment this line
irrecv.enableIRIn(); // Start the receiver
pinMode(led1, OUTPUT);
myservo.attach(9);
}
void loop() {
//if (button1pressed)
if (irrecv.decode(&results)) {
unsigned int value = results.value;
switch(value) {
case button1:
if (itsONled[1] == 1) {
digitalWrite(led1, LOW);
itsONled[1] = 0;
}
else {
digitalWrite(led1, HIGH);
itsONled[1] = 1;
}
break;
}
Serial.println(value);
irrecv.resume();
}
if(itsONled[1] == 1)
{
if(millis() - lastServoMove > 15)
{
myservo.write(pos);
if(pos == 80)
{
increment = -1;
}
if(pos == 0)
{
increment = 1;
}
pos = pos + increment;
lastServoMove = millis();
}
}
}
Step 3: Putting It All Together
Final steps I put all the printed pieces together, painted the face, and inserted the LED's for the final touch.