Tetromino

A strange video game controller meant to play Online Tetris.

projectImage

Story

 

What happens when you mix cardboard and wires together? You get the Tetromino controller. This strange video game controller is made for Online Tetris. It is a box with 5 buttons, all of them are in 3 different colors based on what they do. The yellow buttons control moving left and right, the green buttons control block rotations, and the black button on top controls the drop move to drop the blocks faster.

 

These five buttons are wired to a Circuit Playground Express chip and the code allows the button presses to be mapped out specifically for the keyboard controls of Tetris. They are mapped out to the arrow keys and the Z key just like the online Tetris game’s controls. The Circuit Playground Express is powered by a USB connecting to a computer to play the game. If you want a little bit of challenge when playing Tetris online, this controller is for you.

 

Tetris Online: https://tetris.com/play-tetris

 

Video of working controller:

 


 

Schematics

Began build

projectImage

Box for electronics housing

projectImage

Completed Wiring

projectImage

Completed Controller

projectImage

Code

Code for Controller

Arduino

CODE
#include "Adafruit_CircuitPlayground.h"
#include "Keyboard.h"
char left = KEY_LEFT_ARROW;
char right = KEY_RIGHT_ARROW;
char down = KEY_DOWN_ARROW;
char up = KEY_UP_ARROW;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
CircuitPlayground.begin();
CircuitPlayground.clearPixels();
Keyboard.begin();
pinMode(A1, INPUT);
pinMode(A6, INPUT);
pinMode(A4, INPUT);
pinMode(A7, INPUT);
pinMode(A3, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
Serial.println(analogRead(A1));
if(analogRead(A1) < 5){
CircuitPlayground.setPixelColor(0 , 255,255,255);
Keyboard.press(left);
delay(100);
Keyboard.releaseAll();
delay(100);
CircuitPlayground.clearPixels();
}
if(analogRead(A6) > 1000){
CircuitPlayground.setPixelColor(0 , 255,0,0);
Keyboard.press(right);
delay(100);
Keyboard.releaseAll();
delay(100);
CircuitPlayground.clearPixels();
}
if(analogRead(A4) < 5){
CircuitPlayground.setPixelColor(0 , 0,255,0);
Keyboard.press(down);
delay(100);
Keyboard.releaseAll();
delay(100);
CircuitPlayground.clearPixels();
}
if(analogRead(A7) < 5){
CircuitPlayground.setPixelColor(0 , 0,0,255);
Keyboard.press(up);
delay(100);
Keyboard.releaseAll();
delay(100);
CircuitPlayground.clearPixels();
}
if(analogRead(A3) > 1000){
CircuitPlayground.setPixelColor(0 , 255,0,255);
Keyboard.press('z');
delay(100);
Keyboard.releaseAll();
delay(100);
CircuitPlayground.clearPixels();
}
}

The article was first published in hackster, December 2, 2021

cr: https://www.hackster.io/bryce-brauckmuller/tetromino-0de1be

author: Bryce Brauckmuller

License
All Rights
Reserved
licensBg
0