Arduino Introduction — Sean

I had some previous experience with Arduinos before, but I had never incorporated an LCD screen into a project before. One of my challenges was trying to figure out what I should do with the LCD screen. I decided I wanted to do some type of game where the goal is to avoid the obstacles coming. I created this storyboard for it:

I originally wanted to go with a joystick in order to control the character on the screen, but I couldn’t find one. I decided to go with an ultrasonic sensor instead. The way I was going to use the ultrasonic sensor was to have different thresholds that would determine which side of the screen the player is on. These thresholds would be triggered based on how far an object is from the Ultrasonic Sensor–in this case, I used my hand as the “controller.” I had it where if my hand was less than 14cm away it would move the character to the right and if it was greater than 14cm it would move the character to the left. As of now, there are only five walls that can appear at a time and the walls move pretty slowly, so it is very easy.

The following images is what i had for the final product:

 

LCD that was used for the graphics
Arduino and Electronics used

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The code is linked here: https://www.dropbox.com/s/5yi8h67q3qt6g6l/Joystick_Control.cpp?dl=0

For the ultrasonic sensor portion I used this website to help with the code and wiring: https://www.tutorialspoint.com/arduino/arduino_ultrasonic_sensor.htm

During the project, my main challenges were actually generating the obstacles so it wouldn’t be impossible to avoid. I had many times where the walls would appear on top of each other resulting in it being impossible to avoid. I was able to solve this by having some conditions that would check for this. There is currently an issue with the LCD screen refreshing too much which results in what looks like a flickering effect. This could be solved with rearranging the code a little bit to keep the title and gameover screens from refreshing too much.

 

I enjoyed learning more about the Arduino and the LCD screen during this project.

Facebook
Twitter
LinkedIn
Pinterest