Arcade Cabinet for Tablets
Jump to navigation
Jump to search
The goal of this project is to provide arcade-style cabinet for 11-inch tablets.
Hardware
- 10 mm plywood or MDF
- 1 Joystick
- 8 (or less) Arcade buttons
- 1 power switch
- 1 Arduino Leonardo (better since it can emulate a keyboard or a mouse (HID))
- 1 Bluetooth module for Arduino
- 2 4-ohms speakers (recycled or not).
- 1 Audio amplifier or 5v Audio Amplifier
- 1 Android tablet
Extra
Design
- Figures for laser cutters (PDF and ODG formats) Media:ArcadeCabinetTablet.zip
- Electronic Schema (Fritzing)
Software
Arduino sketch
const int NBANABUT = 4; const int aButton[NBANABUT] = {A2, A3, A4, A5}; //const int aChar[NBANABUT] = {'1', '2', '3', '4' }; const int aChar[NBANABUT] = {KEY_UP_ARROW, KEY_RIGHT_ARROW, KEY_DOWN_ARROW, KEY_LEFT_ARROW}; int aFlag[NBANABUT] = {false, false, false, false }; const int NBDIGBUT = 8; const int dButton[8] = {2, 3, 4, 5, 6, 7, 8, 9}; //const int dChar[8] = {'A', 'B', 'C', 'D', 'E','F','G','H' }; const int dChar[8] = {KEY_RETURN, 'B', 'C', 'D', 'E','F','G','H' }; int dFlag[8] = {false, false, false, false, false, false, false, false }; void setup() { for(int d=0;d<NBDIGBUT;d++) pinMode(dButton[d], INPUT_PULLUP); Keyboard.begin(); } void loop() { for(int d=0;d<NBDIGBUT;d++) { if (!dFlag[d] && digitalRead(dButton[d]) == HIGH) { Keyboard.press(dChar[d]); dFlag[d]=true; } else if (dFlag[d] && digitalRead(dButton[d]) == LOW) { Keyboard.press(dChar[d]); dFlag[d]=false; } } for(int a=0;a<NBANABUT;a++) { if (!aFlag[a] && analogRead(aButton[a]) > 1024/2) { aFlag[a]=true; Keyboard.release(aChar[a]); } else if (aFlag[a] && analogRead(aButton[a]) < 1024/2) { Keyboard.press(aChar[a]); aFlag[a]=false; } } }
Processing sketches
- Test
- Pacman http://www.openprocessing.org/sketch/46944
- Space Invaders http://www.openprocessing.org/sketch/6572