Bryce Brauckmuller
Published © GPL3+

Tetromino

A strange video game controller meant to play Online Tetris.

IntermediateShowcase (no instructions)144
Tetromino

Story

Read more

Schematics

Began build

Box for electronics housing

Completed Wiring

Completed Controller

Code

Code for Controller

Arduino
#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();
}
}

Credits

Bryce Brauckmuller

Bryce Brauckmuller

2 projects • 0 followers

Comments