I wanted to do something similar to an ball game arcade, and when win or score a certain points, it will give out biscuits or cookies.
It would be great for the exhibition, since the cookies can attract people come and have a go at the project.
A picture showing an existing ball game arcade.
What I want to achieve:
LCD displaying score, sensors to register score, light to indicate score being registered.
So I started off with using a button to register a text into the arduino, also added an LCD screen to show if the button is pressed or not.
However, the arduino kept registering constantly, when I only want it to register once everytime I press it.
So I added a delay to it.
It worked out alright, but it delays the whole arduino system and it will only register another input when the delay finishes.
So I had to rewrite the code.
I solved it by adding lastButtonState=buttonState; in the sketch
what this does is that it actually is updating the new button state.
At this point, the basic structure of my project is done.
So I added another set of the sketch for the second button.
Plus, added a Welcome screen to it.
I finished off with adding a servo motor to the arduino, the servo is for opening the box of biscuits, when the player reaches a certain point (in this case its 10 points).
I added a delay to the servo to tease the player. When the player reaches 10 points, it will open and close very quickly. and then after 10 second it is when it actually open, it will automatically close after 10 seconds. A reset button is also added.
The second video shows a better view of the teasing mechanism.
There are 3 holes and the smallest one is 3 points, 2 points for the middle one, and 1 point for the large one. When the score reaches 10 points, the box opens and closes really quickly for the tease, and then opens after 10 seconds for 10 seconds. Yellow button to reset.
If I were to improve this project, I would definitely use a light gate for the sensor instead of the buttons, because the balls would bounce up and down and end up hitting the button few times or even more.