ATLAS Form: Week 12 Design Goal


ATLAS Object: Game or Audio Controller

For this lab, we were tasked with developing a game using P5JS that responded to two different inputs from the Arduino. I decided not to use my sensor box since my sensor box was falling a part due to poor construction. I decided to make a prototype of something similar to my final project idea.

Programming with P5.js

P5js is a new tool for me. I have some familiarity with javascript but it was still a bit of a learning process. I found a Breakout clone online that was written in P5js that I used as a base for my project ( I studied the code to figure out how it worked and changed various aspects to make this work for my project. I removed the bricks and made the game similar to wall ball. During testing, I made the bar be able to move via the arrow keys on my computer. I made the ball get faster over time and reset whenever the ball falls below the screen (the player failed to rebound it.)


Building the circuit

Next, I had to build the actual circuit. I thought it would be cool to use an ultrasonic sensor to make the bar move when the user brings their hand close to the sensor. I had the bar move to the left when no object is detected and to the right when an object is detected. Since I needed a second input, I made a potentiometer be able to change the color of the ball.

Diagram of circuit:

My circuit diagram.

Video of working circuit

Ultrasonic sensor

Potentiometer color changing ball

Code Link:

What I would do differently.

For my final project I am making motion pong. The game will be controlled with motion sensors. I will need to figure out how to smooth the sensor value better as in this implementation of the ultrasonic sensor, the bar was a little bit shaky. I would also use a library with physics rather than writing complicated code to deal with collisions simply based on the x and y location of the ball and other objects.


ATLAS Form: Week 11 Design Goal

Let it snow.