Main Content

The classic snake game but implemented on a ATiny85

When it comes to electronics, it’s the free-form designed ones that always catch my eye. Seeing how all the wires and components are connected just make it so fascinating and nice to look at. I wanted to try building something in a similar style. Being aware my soldering skills are not as good as I’d like them to be, I decided to go for a bit easier but still kind of nice-looking option. The whole build was a process of trial and error that probably cost me a bit more time than I’d like to admit. It was also the first time I ever used a ATtiny (or anything besides an Arduino Uno), which posed many challenges. But I ended up learning a lot throughout the making, so hopefully you’ll do too!

PROGRAMMING YOUR ATTINY:
I was using a chip without a development board, so I used my Arduino Uno as an ISP (In-System-Programmer). To keep this part of the tutorial short, I recommend you follow this article on how to do this. Please note that to make the ATtiny run at 8 MHz, you need to burn the bootloader first.

The code depends on the TinyWireMlibrary developed by Adafruit, so you need to have it in your libraries (if you don’t have it already, add it in Sketch->Include Library->Add Zip Library).

The snakeGame.ino file contains the sketch you are going to upload to your ATtiny. Open it in your IDE, compile and upload. You need to have the oled85.cpp and oled85.h in the same folder as the snakeGame.ino.

NOTE: by default the display assumes a I2C address of 0x3C, in case your display uses a different one, open the oled85.h file and change the #define I2C_ADDR statement.”

Link to article