Hey there! School has kept me pretty busy. None the less here is a quick project I did for fun. I call it Ardupong! Basically just the old pong game recreated with arduino. I made something like this a long time ago. I enjoy small challenges like this though to improve my coding.
I have altered the setup to make a snake game (Ardusnake?) but I'm still working on the code.
The setup is pretty simple. There are five buttons: 2 for each player and 1 for a start button. There is a piezo buzzer for some sound effects. Two 8x8 led matrix are hooked up via spi. I found these displays pretty cheap a while ago. Here is a little diagram of the circuit.
The code is pretty simple too. It is setup is a sort of state system. The program runs a title screen until the start button is pressed. It then begins a game. Each round the players and ball are reset. The ball starts in the middle and chooses a random direction to move in. The hardest part was planning the motion of the ball. The ball can move in four directions (left-up,left-down,right-up,right-down). It checks if the ball has hit a wall, passed the players, or if the players are there to block the ball. If the ball hits the edge of a player the ball goes back in the direction it came. Otherwise it bounces off the player.
The code for this project is here. I'm using GitHub for the first time, figured I should probably learn how to use it since everyone else does. I'm also naming these projects Arducade. Hopefully I will make some other simple games.