Since the last post, we've successfully improved the trajectories of the ball to respond to collisions with the paddle, the wall, a second ball, or obstacles. Furthermore, we've improved the interactive nature of the game by adding a sound every time a paddle hits the ball or a ball has a collision. By quickly incrementing and decrementing the frequency of the outputted sounds, we were able to generate one tune for when a player misses a ball and another tune at the end of the game.
At the beginning of each round, the players must press one of the following.
Yellow Button - Single ball
Green Button - 2 balls
Blue Button - obstacles
Red Button - random setting
At the culmination of the game, the players may press the Red button in order to reset the game and reset the score to 0-0.
We also soldered the 4 buttons and the speaker onto a small board in order to prepare for the final display of the project. We are contemplating making amendments to the wiring of the sensors in order to improve their ease of use and responsiveness to movement.
We've displayed a screenshot here so that you can see the set-up of the buttons along with the configurations of the obstacles. You can also view the demo on YouTube, since we are currently experiencing difficulties uploading it to the blog.
The yellow button starts the game when pressed and also resets the board after every new round.
The program displays the score of each player after each round. Every time either player misses the ball, the score of the opposite player increases, and both players' scores are displayed on the board. The board then clears and starts a new round when the yellow button is pressed.
Today, we successfully added both paddles to the game. Initially, we encountered some problems due to loose contact between the sensor pins and the protoboard. We managed to alleviate this problem after creating our own right-angle pins with the use of pliers . The game is now at a stage where two players can play the game.
Current Features: 1. The players can hit the ball back and forth in relatively straight lines. 2. Depending on the point of contact with the paddle, the ball will either return in the same column or shift over one in the rebounding path. 3. A simple condition is included so that if the paddle hits a ball in the column next to the wall, it also shifts over a column 4. A round is completed with one player misses the ball. For testing purposes, the game currently consists of 2 rounds. 5. The row in which the losing player's paddle in the final round resides lights up. 6. There is currently no pause between rounds, and the ball immediately returns to the middle of the board.
Upcoming modifications: 1. The red row should light up for the player with the lowest score, not for the player losing the final round. 2. The movement of the paddles can be made smoother with the incorporation of a running average calculation. Sometimes, the paddle looks as though it occupies 4 LEDs instead of 3. 3. Create a pause between rounds. Potential ideas include a delay incorporating an overflow counter or a button that will start a new round when pressed.
Our game has made steady progress over the weekend. The first steps were soldering 128 LEDs onto the two monome boards. One row on each board is entirely made of red LEDs, so that the paddles will light up a different color than the ball, which will be blue. So far, we've managed to link ports A and B on the microcontroller in order to control all 16 rows of the combined board at once. We've decided to keep track of the location of both the balls and paddles in a 16x8 array. The paddles are controlled by Firefly sensors, whose x-out outputs are connected to ADC ports 0 and 1. The range in which the ADC converted values fall determines the location of the paddles. A real-time interrupt is implemented in order to constantly read the array and display the contents on the monome boards. The RTI uses a counter so that with each calling of the interrupt, a different row will be lit. This is necessary because the ports cannot supply enough power to light the entire board at once. Furthermore, we've managed to get the ball to bounce back and forth against one stationary paddle. The next step will be to integrate both paddles with the design and get the ball to move in a simple, mostly straight line back and forth between the paddles.