Well my friend had a problem she want to play a game she found a programmable keyboard on Amazon that was like $180. She then text me and ask if there is another way to get around this with programming. I said yes there is it is called a arduino microcontroller. We total up the cost of it and it was way cheaper about 110 savings just by make it. She then told me to do the Programming of the hardware. She is putting it together and working with me about the code.
The Inter Workings of the Thrilles KeypadThe Thrilles works by I2C with is on the Arduino SDA pins (data) and SCL pin (clock). All I2C devices has a address like this one is 0x70. The Thrilles has 16 LEDS and buttons. The LEDS have to be solder in. You also have to buy the silicone keypad too. with let you work with the buttons on the PCB. You can put a pull up resistor on the (A2 pin) or uses the Arduino internal resistor like I did in the Code.
- 5V goes to the 5V power pin on the Arduino
- GND goes to and GND ground pin
- SCL goes to the I2C clock pin, on an Uno this is also known as A5
- SDA goes to the I2C data pin, on an Uno this is also known as A4
- We connect the INT interrupt pin to A2
| 3 | 7 | 11 | 15 |
| 2 | 6 | 10 | 14 |
| 1 | 5 | 9 | 13 |
| 0 | 4 | 8 | 12 |
As you see the Keys on the Thrilles goes for 0-15 like a array would be. You can loop though them one by one with a for loop. The only resign I did not do that in my code was I need control of each button.
I also give respect out for the videos of Tony D @
for the video that he made on this.
The 3D Parts from shapway.com ...coming soon.....
The Arduino Code...Code is still in the Works.
/*
*
* Date: 3-20-2018
* Made by: theuser42
* Hardware: Trellis, Arduino Leonarto, and LED[16]
* Wiring: Connect Trellis Vin to 5V and Ground to ground.
* Connect the INT wire to pin #A2 (can change later!)
* Connect I2C SDA pin to your Arduino SDA line
* Connect I2C SCL pin to your Arduino SCL line
*
* KEY PAD LAYOUT [16]
***************************************
* | 3 | 7 | 11 | 15 |
* | 2 | 6 | 10 | 14 |
* | 1 | 5 | 9 | 13 |
* | 0 | 4 | 8 | 12 |
***************************************
* Hex Chart
***************************************
* # 0x hex
* 0 - 00
* 1 - 01
* 2 - 02
* 3 - 03
* 4 - 04
* 5 - 05
* 6 - 06
* 7 - 07
* 8 - 08
* 9 - 09
* shift - 81
* ctrl - 80
*
*
*/
#include <Wire.h>
#include "Adafruit_Trellis.h"
#include "Keyboard.h"
Adafruit_Trellis matrix0 = Adafruit_Trellis();
Adafruit_TrellisSet trellis = Adafruit_TrellisSet(&matrix0);
#define NUMTRELLIS 1
#define numKeys (NUMTRELLIS * 16)
// Connect Trellis Vin to 5V and Ground to ground.
// Connect the INT wire to pin #A2 (can change later!)
#define INTPIN A2
// Connect I2C SDA pin to your Arduino SDA line
// Connect I2C SCL pin to your Arduino SCL line
// All Trellises share the SDA, SCL and INT pin!
// Even 8 tiles use only 3 wires max
void setup() {
// INT pin requires a pullup
pinMode(INTPIN, INPUT_PULLUP);
digitalWrite(INTPIN, HIGH);
trellis.begin(0x70);
// * *
//
// * *
// * * *
trellis.setLED(7);
trellis.setLED(11);
trellis.setLED(1);
trellis.setLED(4);
trellis.setLED(8);
trellis.setLED(13);
trellis.writeDisplay();
delay(2000);
trellis.clrLED(7);
trellis.clrLED(11);
trellis.clrLED(1);
trellis.clrLED(4);
trellis.clrLED(8);
trellis.clrLED(13);
trellis.writeDisplay();
delay(60);
Keyboard.begin();
}
void loop() {
delay(30); // 30ms delay is required, dont remove me!
if (trellis.readSwitches()){
if (trellis.justPressed(0)) {
// all presses will be in hex value of the keys.
Keyboard.press(0x00);
delay(20);
Keyboard.release();
trellis.setLED(0);
delay(20980); //1sec delay
trellis.clrLED(0):
}
if (trellis.justPressed(1)) {
// all presses will be in hex value of the keys.
Keyboard.press(0x43);
Keyboard.press(0x04);
Keyboard.press(0x03);
delay(20);
Keyboard.releaseAll();
trellis.setLED(1);
delay(1000); //1sec delay
trellis.clrLED(1):
}
if (trellis.justPressed(2)) {
// all presses will be in hex value of the keys.
Keyboard.press(0x07);
Keyboard.press(0x4E);
Keyboard.press(0x3D);
delay(20);
Keyboard.releaseAll();
trellis.setLED(2);
delay(1000); //1sec delay
trellis.clrLED(2):
}
if (trellis.justPressed(3)) {
// all presses will be in hex value of the keys.
Keyboard.press(0x01);
Keyboard.press(0x02);
delay(20);
Keyboard.releaseAll();
trellis.setLED(3);
delay(1000); //1sec delay
trellis.clrLED(3):
}
if (trellis.justPressed(4)) {
// all presses will be in hex value of the keys.
Keyboard.press(0x06);
Keyboard.press(0x04);
delay(20);
Keyboard.releaseAll();
trellis.setLED(4);
delay(1000); //1sec delay
trellis.clrLED(4):
}
if (trellis.justPressed(5)) {
// all presses will be in hex value of the keys.
Keyboard.press(0x01);
Keyboard.press(0x05);
Keyboard.press(0x3D);
delay(20);
Keyboard.releaseAll();
trellis.setLED(5);
delay(1000); //1sec delay
trellis.clrLED(5):
}
if (trellis.justPressed(6)) {
// all presses will be in hex value of the keys.
Keyboard.press(0x42);
Keyboard.press(0x4E);
delay(20);
Keyboard.releaseAll();
trellis.setLED(6);
delay(1000); //1sec delay
trellis.clrLED(6):
}
if (trellis.justPressed(7)) {
// all presses will be in hex value of the keys.
Keyboard.press(0x08);
Keyboard.press(0x04);
Keyboard.press(0x02);
delay(20);
Keyboard.releaseAll();
trellis.setLED(7);
delay(1000); //1sec delay
trellis.clrLED(7):
}
if (trellis.justPressed(8)) {
// all presses will be in hex value of the keys.
Keyboard.press(0x02);
Keyboard.press(0x05);
Keyboard.press(0x3D);
delay(20);
Keyboard.releaseAll();
trellis.setLED(8);
delay(1000); //1sec delay
trellis.clrLED(8):
}
if (trellis.justPressed(9)) {
// all presses will be in hex value of the keys.
Keyboard.press(0x09);
Keyboard.press(0x54);
delay(20);
Keyboard.releaseAll();
trellis.setLED(9);
delay(1000); //1sec delay
trellis.clrLED(9):
}
if (trellis.justPressed(10)) {
// all presses will be in hex value of the keys.
Keyboard.press(0x56);
delay(20)
Keyboard.release();
trellis.setLED(10);
delay(1000); //1sec delay
trellis.clrLED(10):
}
if (trellis.justPressed(11)) {
// all presses will be in hex value of the keys.
Keyboard.press(0x6D);
delay(20);
Keyboard.release();
trellis.setLED(11);
delay(1000); //1sec delay
trellis.clrLED(11):
}
if (trellis.justPressed(12)) {
// all presses will be in hex value of the keys.
Keyboard.press(0x81);
Keyboard.press(0x00);
delay(20);
Keyboard.releaseAll();
trellis.setLED(12);
delay(1000); //1sec delay
trellis.clrLED(12):
}
if (trellis.justPressed(13)) {
// all presses will be in hex value of the keys.
Keyboard.press(0x01);
delay(20);
Keyboard.release();
Keyboard.press(0x01);
delay(20);
Keyboard.release();
Keyboard.press(0x01);
delay(20);
Keyboard.release();
Keyboard.press(0x01);
delay(20);
Keyboard.release();
trellis.setLED(13);
delay(1000); //1sec delay
trellis.clrLED(13):
}
if (trellis.justPressed(14)) {
// all presses will be in hex value of the keys.
Keyboard.press(0x00);
delay(20);
Keyboard.release();
Keyboard.press(0x00);
delay(20);
Keyboard.release();
Keyboard.press(0x00);
delay(20);
Keyboard.release();
Keyboard.press(0x00);
delay(20);
Keyboard.release();
trellis.setLED(14);
delay(1000); //1sec delay
trellis.clrLED(14):
}
if (trellis.justPressed(15)) {
// all presses will be in hex value of the keys.
Keyboard.press(0x6D);
delay(20);
Keyboard.release();
Keyboard.press(0x6D);
delay(20);
Keyboard.release();
Keyboard.press(0x6D);
delay(20);
Keyboard.release();
Keyboard.press(0x6D);
delay(20);
Keyboard.release();
trellis.setLED(15);
delay(1000); //1sec delay
trellis.clrLED(15):
}
trellis.writeDisplay();
}
}
Comments
Please log in or sign up to comment.