Intro: Arduino Tetris TVout
I have reproduced a B&W version of the classical game TETRIS running for PAL composite TV output, with a resolution of 128 x 64 pixel.
A video showing how it looks is available here.
As in all my previous instructables, there is no need for special game shields or further supporting IC, as compared to other versions available on the Net. You only need a bare Arduino Uno and few other components, such as buttons, resistors and a RCA connector (and eventually a speaker).
This game is a "conversion" plus some improvements of my previous color version for VGA monitors, shown here.
The game had different levels where the speed icreases and it shows the score. Sound has been addet too.
Step 1: Schematic and Code
To reproduce this game you need first to download the code, available at the bottom of this page (remember to copy it in a folder with the same name).
Then you need to download the TVout libraries, that has to be saved in the same folder of the standard Arduino libraries.
You can immediatly upload them on an Arduino Uno. If you don't get any other error message, you can start to build your hardware!
You need the following components:
- an Arduino/Genuino Uno - original or a clone, but original is better :-)
- an RCA female connector
- resistors for the video signal: one of 1 kOhm and one of 470 Ohm
- resistors for the buttons: one for every button with value from about 1 to 2 kOhm
- four buttons plus one facoltative
- a PC board or just some wire and pins
- facoltative: a speaker
Connect the parts as shown in the upper schematic.The speaker must be connected to pin 11.
You can assemble them as you prefer (eventually on a bread board for the preliminary tests).
As an example, I put the Arduino in a pre-existing box with buttons I got from some scrap. Since it has already 5 square buttons (plus four other small ones I did not use), I decided to implement the following movements for the "tetraminos" pieces: turn clockwise, turn anti-clockwise, shift left, shift right and fast shift down. One of the two turn buttons can be neglected (for instance clockwise). In this case you need to connect the corresponding Arduino analogue pin (A2) to ground!
Another example is with a wood box and four buttons, as shown in the upper picture.
If you have done everything properly, it should be immediately possible to play!