Soccer is the world's most popular sport in the world according to Wikipedia - and all my neighbors in Buenos Aires, Argentina - so I’ve decided to make a small tribute with this Arduino handheld game.
It was a lot of fun to create everything from scratch like in the old TK85 days: the Argentine anthem buzzer notes for the opening screen, the sprite for the player and the algorithm for the goal keeper.
The game will be included soon in an Arduino projects book so I cannot post the entire code and circuits yet but if you have any question for your own Arduino/OLED game I will be more than happy to assist.
Components for this project:
Arduino Nano (other Arduinos will work as well)
OLED screen (128x32 duotone)
Mini joystick with a custom 3D-printed thumbwheel https://www.thingiverse.com/thing:3091591
Switch
TP4056 battery charger
Battery from an old Samsung phone
Custom 3D-printed enclosure
Code for Argentine anthem (Maradona and Messi are from Argentina, BTW)
int speakerPin = 7;
int length = 13; // the number of notes
char notes[] = "cecgfdbbbbcdc"; // a space represents a rest
int beats[] = {8, 8, 2, 8,2, 2, 4, 4, 4, 4,1,1,8};
int tempo = 80;
// Catcher not there and ball is inside!
if ( (ballY-1<catcherY || ballY>catcherY+4) && (ballY>12 && ballY<28) && dontScore==0 ){
Serial.println("Score!");
score=score+1;
tone(speakerPin, 2000); // Ring
delay(100);
noTone(speakerPin);
ballX=120;
dontScore=1;
}
Finally, a demo video of the mini soccer Arduino game.
Complete code and circuits for this project are included in Fun Projects with Arduino #2 (free download with Kindle Unlimited)
Thanks for your interest and feedback. Have a great geek day.
Comments
Please log in or sign up to comment.