Introduction: Tetris Clone With OLED SSD1306(I2C) for Arduino Nano / Uno

This Instructable is about getting Tiny Tetris running on a 128x64 OLED display using an Arduino Nano or Uno.

Step 1: What You Need.

Arduino Nano or Arduino Uno:

Nano

Uno

Display:

OLED I2C SSD1306

Keypad:

AD Analog Keyboard Module

Note: other key pads and switch configurations could be used but you would need to change the code.

Some cables to connect things:

Cables

Step 2: Uno Wiring

Uno wiring:

Note: the key pad shown represents the pad in the parts list, I have not built the one shown but if you did it would be easy to get it working, only a few small changes would be needed in the code.

Fritzing Part

Step 3: Nano Wiring

Nano wiring:

Note: the key pad shown represents the pad in the parts list, I have not built the one shown but if you did it would be easy to get it working, only a few small changes would be needed in the code.

Fritzing Part

Step 4: The Code

If you are new to Arduino have a look at this to get started:

How to have fun with Arduino

Code attached and on GitHub below:

Code on GitHub - this has the most up to date code including Art work and Sound!

There is still a lot to be done with the code, see below:

High score functionality.

[Done] Better key pad control code.

Decent random number generator.

[Done] Start thinking about adding sound.

Create a letter font, create a proper system for rendering numbers and letters.

Tidy up code and optimize for memory, sort out the globals and types.

Create defines for all the magic numbers but they are useful for now.

Step 5: Have Fun!