Concept
The goal of this Final Project is to create a physically interactive system that relies on a multimedia computer for some sort of processing or data analysis. My Final Project uses BOTH P5 AND Arduino to create a Mini Basketball Arcade Machine. The mini Basketball Arcade Machine will be a tabletop-sized arcade game that will allow users to play basketball by shooting miniature basketballs into a hoop. Whenever the ball successfully passes through the hoop, it makes contact with the flex sensor causing alterations in its readings. As soon as a modification is identified in the flex sensor’s values, the player is credited with certain amount of points. Failing to score does not result in any reduction in points. The game has a time limit, and when the time runs out, a buzzer sounds, signaling the end of the game. The player can then view their score and the highest score achieved, and they have the option of playing again. The machine will use Arduino to sense when the user shoots the basketball and p5.js to display the score and time on the scoreboard.
Arduino
The Arduino program will read the sensor input to determine when the ball has been shot and passed through the hoop. The circuit will consist of a flex sensor and a resistor, with the flex sensor connected to an analog input on the Arduino board. The Arduino program will read the analog input to determine the current value of the flex sensor, which will change whenever a basketball passes through the hoop and contacts the sensor.
The Arduino program will send this flex sensor value to the P5.js program for processing and display on the scoreboard. The P5.js program will receive this data from the Arduino program and use it to update the score based on the number of successful shots made by the player. In summary, the Arduino program for the mini basketball arcade machine will read the flex sensor value from the circuit, send this value to the P5.js program for processing and display, and keep track of the time limit of the game.
Additionally, I am planning to test photoresistor and infrared distance measurer as potential types of sensors for detecting when the basketball passes through the hoop. Based on my testing I would determine whether flex sensor is the most accurate and well-designed option.
P5.js
The P5.js program for the mini basketball arcade machine will be responsible for displaying the game interface, keeping track of the player’s score, and communicating with the Arduino program to receive data about the current state of the game. The P5.js program will display the scoreboard on the computer screen, showing the player’s current score and the time remaining in the game. It will also display the basketball hoop and the basketballs for the player to shoot.
When the player shoots a basketball and it passes through the hoop, the flex sensor in the circuit will detect the change in resistance, and the Arduino program will send this data to the P5.js program. The P5.js program will receive the data from the Arduino program and update the player’s score based on the successful shot.