In this project, we built the classic snake game using Atmega32 and a 16x8 LED dot matrix display.
🎥 To see how it works , take a look at This Link
The game starts with a 2-dot snake and the player can control the snake by 4 push buttons. The snake grows by one dot after eating the food and the player's score is incremented by one. The game continues until the snake eats itself after which the game is over and the player's score and the game highscore is shown. Also the game highscore is retrieved from EEPROM and updated if the the highscore is beaten.
-
SPI for LED Matrix interfacing.
-
EEPROM for Game HighScore
-
Initialise Snake with two dots. The snake is represented by a 50x2 matrix with each dot represented by the position on the matrix(x,y)
-
The direction is taken and the snake is moved one dot accordingly.
-
If the snake head touches the food pixel, then the snake is grown and a food pixel is drawn randomly on the screen and the loop continues.
-
If the snake head touches itself, then the loop breaks and the player's score and highscore is displayed on the screen. The game variables are reset and the loop continues.
- 1 × AVR ATmega32 Microcontroller
- 2 × 8x8 LED Dot Matrix Module
- 4 × Push Button
-
Completed the game logic(main.c file)
-
Wrote library to interface atmega32 with two serially connected 8x8 led matrices controlled by MAX2719 drivers (led_control.c file)
-
Load highscore from eeprom
-
Interface accelerometer
-
Assembled the AVR with push buttons and the LED Dot Matrix.
-
Found libraries to interface the LED Matrix (which is controlled by a MAX2719 driver) with the atmega32.
-
Worked on the basic game loop - wrote function definitions for snake and the board.
-
Working on displaying the player's score on 2 seven segment displays
-
Working on the game logic - detecting collision and updating scores of player.
Reach out to us at one of the following places!
- Telegram at @BitterOcean
- Telegram at @sajede_nick
- Telegram at @Khoramian2
- Telegram at @mArZiEh_aLiDaDi