LED matrix snake game

In this tutorial we are going to create the classic snake game using Nova. This project lets you play the snake game by controlling an LED "snake" on the matrix using simple button inputs. This is perfect for beginners and enthusiasts alike, we are going to learn through coding, and wiring. Finally, we will be able to play the snake game on Nova itself.

 

Supplies

 

  1. Nova
  2. Push buttons (5 total: UP, DOWN, LEFT, RIGHT, RESET)
  3. External pull-down resistors (for button stability)
  4. Arduino IDE with RP2040 support and FastLED library
  5. A Breadboard

     

    Step 1: Set up your Nova

    1. Attach Nova to a breadboard

    Begin by placing your Nova board onto a breadboard for stability and easy wiring.

    1. Connect the Buttons

    Connect each directional button to the respective pins on the Nova board:

    1. UP Button: connect to pin 2
    2. LEFT Button: connect to pin 3
    3. DOWN Button: connect to pin 4
    4. RIGHT Button: connect to pin 5
    5. RESET Button: connect to pin 6

    Use external pull-down resistors with each button to ensure reliable signal readings.

     

    Step 2: Upload your code

    Click on the link below to download the code. This code initializes the LED matrix, defines snake movement, and handles button inputs for game control.

    NovaSnakeCode.ino

     

    Step 3: Play the game!

    With everything set up, reset the game and try it out! Control the snake by pressing the buttons to guide it towards the red "food" dot. Avoid crashing into the walls or your own tail, or you'll have to hit reset and start over.

     

    Step 4: Customize the game

    Here are a few ways to experiment:

    1. Adjust the Speed: Modify the snakeSpeed variable for a faster or slower game.
    2. Change the Snake Color: Adjust the color in the code to make the snake a different shade.
    3. Add More Levels: Try making the game harder as you eat more food.

    You've successfully created your own Snake game using Nova! This project is a fun way to dive into programming LEDs and buttons and is easily expandable for other games or applications. Have fun coding, and happy gaming!

    Back to blog

    Leave a comment

    Please note, comments need to be approved before they are published.