Arduino Snake Game Using OLED LCD Module
| Wayne Chen
This Project shows you how to build a portable snake game using Arduino UNO R3.
You can play the game on the OLED screen and control it with the joystick. There is also a function to display the QR code on the screen.
If you have any other questions about this project, let me know in the comments below.
- Arduino UNO R3
- UNO Proto Prototype Shield
- 0.96" Inch Blue I2C IIC OLED LCD Module
- JoyStick Module
- Male to male wire 5cm
- Female to male wire 15cm
- Power Supply
When we power up the circuit, first display the "Snake Game Kuongshun" message on the OLCD screen, then press the joystick to display the game. At the beginning of the game, the snake starts to move to the right by default. Then, the user needs to control the direction of the snake by manipulating the joystick. Whenever the snake reaches to the food dot or eats the food, each time and the Snake length is increased by one dot (LED) each time, also snake speed become faster than before. And whenever snake would strike at any wall or reach at the end of LCD, it will end the game and display 'Game Over'. Then the user needs to select "Snake" in the menu to start the game again. In the menu, we have added the QR code of "Kit Purchase".When you scan the QR code, a link to this website will appear. The above is a summary of this Snake game.
The Arduino UNO R3 used here handles two functions, one is to collect joystick data, and the other is to control the OLED display. A0 reads the data of the X-axis of the joystick, A1 reads the data of the Y-axis of the joystick, and D2 reads the joystick confirmation button. The OLED interface is IIC interface, in which SCK connects to A5 and SDA connects to A4. After the program is executed, Arduino first controls the OLED display welcome interface, then enters the selection interface and waits for the user command.