Close
0%
0%

MineCraft Sidecar Keypad

A Minecraft keypad setup with various macros

Similar projects worth following

First I had to find something to replace the aging brain of this old device. I have always been interested in microcontrollers and this looked like a great way to start and learn some new things. Check through all of my bookmarks for various sites and such and then found the base for this new project. The Teensy, this microcontroller was able to emulate generic HID devices and be programmed in the same IDE as the Arduino.

  • 1 × Old CLAW keyboard input device
  • 1 × Teensy 2.0

  • Code for the Claw

    Toulon10/03/2014 at 23:42 0 comments

    Teensy Claw Rev3 Sketch
    Below is the code for the Claw Rebuild project.
    -------------------------Code Start------------------------ #include <Bounce.h>

    // Debounce button creation
    Bounce keybutton0 = Bounce(0, 40);
    Bounce keybutton1 = Bounce(1, 40);
    Bounce keybutton2 = Bounce(2, 40);
    Bounce keybutton3 = Bounce(3, 40);
    Bounce keybutton4 = Bounce(4, 40);
    Bounce keybutton5 = Bounce(5, 40);
    Bounce keybutton6 = Bounce(6, 40);
    Bounce keybutton7 = Bounce(7, 40);
    Bounce keybutton8 = Bounce(8, 40);
    Bounce keybutton9 = Bounce(9, 60);
    Bounce keybutton10 = Bounce(10, 60);
    Bounce keybutton21 = Bounce(10, 40);
    byte left = 0;
    byte middle = 0;
    byte right = 0;
    byte shift = 0;
    byte clicked = 0;
    void setup() {

    // put your setup code here, to run once:
    pinMode(0, INPUT_PULLUP);
    pinMode(1, INPUT_PULLUP);
    pinMode(2, INPUT_PULLUP);
    pinMode(3, INPUT_PULLUP);
    pinMode(4, INPUT_PULLUP);
    pinMode(5, INPUT_PULLUP);
    pinMode(6, INPUT_PULLUP);
    pinMode(7, INPUT_PULLUP);
    pinMode(8, INPUT_PULLUP);
    pinMode(9, INPUT_PULLUP);
    pinMode(10, INPUT_PULLUP);
    pinMode(11, INPUT_PULLUP);
    pinMode(21, INPUT_PULLUP);
    }

    void loop() {
    int mode = 0;

    mode = digitalRead(11);

    if (mode == HIGH) {
    // turn LED on:
    KeyPad();
    }
    else {
    JoyMode();
    }
    }

    void KeyPad() {
    // put your main code here, to run repeatedly:
    keybutton0.update();
    keybutton1.update();
    keybutton2.update();
    keybutton3.update();
    keybutton4.update();
    keybutton5.update();
    keybutton6.update();
    keybutton7.update();
    keybutton8.update();
    keybutton9.update();
    keybutton10.update();
    byte anyChange = 0;

    // Single press buttons
    // Space Button
    if (keybutton3.fallingEdge()) {
    Keyboard.set_key5(KEY_SPACE);
    Keyboard.send_now();
    }
    if (keybutton3.risingEdge()) {
    Keyboard.set_key5(0);
    Keyboard.send_now();
    }
    // F button
    if (keybutton2.fallingEdge()) {
    Keyboard.set_key6(KEY_F);
    Keyboard.send_now();
    delay(2);
    Keyboard.set_key6(0);
    Keyboard.send_now();
    }
    // Auto Sprint key
    if (keybutton1.fallingEdge()) {
    Keyboard.set_key6(KEY_W);
    Keyboard.send_now();
    delay(2);
    Keyboard.set_key6(0);
    Keyboard.send_now();
    delay(2);
    Keyboard.set_key6(KEY_W);
    Keyboard.send_now();
    }
    if (keybutton1.risingEdge()) {
    Keyboard.set_key6(0);
    Keyboard.send_now();
    }

    // E button
    if (keybutton4.fallingEdge()) {
    Keyboard.set_key6(KEY_E);
    Keyboard.send_now();
    delay(2);
    Keyboard.set_key6(0);
    Keyboard.send_now();
    }
    // D button
    if (keybutton5.fallingEdge()) {
    Keyboard.set_key4(KEY_D);
    Keyboard.send_now();
    }
    if (keybutton5.risingEdge()) {
    Keyboard.set_key4(0);
    Keyboard.send_now();
    }
    // W button
    if (keybutton6.fallingEdge()) {
    Keyboard.set_key1(KEY_W);
    Keyboard.send_now();
    }
    if (keybutton6.risingEdge()) {
    Keyboard.set_key1(0);
    Keyboard.send_now();
    }
    // S button
    if (keybutton7.fallingEdge()) {
    Keyboard.set_key2(KEY_S);
    Keyboard.send_now();
    }
    if (keybutton7.risingEdge()) {
    Keyboard.set_key2(0);
    Keyboard.send_now();
    }
    // Q button
    if (keybutton8.fallingEdge()) {
    Keyboard.set_key6(KEY_Q);
    Keyboard.send_now();
    delay(2);
    Keyboard.set_key6(0);
    Keyboard.send_now();
    }
    // A Button
    if (keybutton9.fallingEdge()) {
    Keyboard.set_key3(KEY_A);
    Keyboard.send_now();
    }
    if (keybutton9.risingEdge()) {
    Keyboard.set_key3(0);
    Keyboard.send_now();
    }
    // Shift Toggle button
    if (keybutton10.fallingEdge()) {
    if (shift == 0) {
    Keyboard.set_modifier(MODIFIERKEY_SHIFT);
    Keyboard.send_now();
    shift = 1;
    }
    else {
    Keyboard.set_modifier(0);
    Keyboard.send_now();
    shift = 0;
    }

    }

    // Mouse button left
    if (keybutton0.fallingEdge()) {
    if (clicked == 0) {
    left = 1;
    anyChange = 1;
    clicked = 1;
    }
    else {
    clicked = 0;
    left = 0;
    anyChange = 1;
    }
    }



    if (anyChange) {
    Mouse.set_buttons(left, middle, right);
    }

    }
    void JoyMode(){
    // put your main code here, to run repeatedly:
    keybutton0.update();
    keybutton1.update();
    keybutton2.update();
    keybutton3.update();
    keybutton4.update();
    keybutton5.update();
    keybutton6.update();
    keybutton7.update();
    keybutton8.update();
    keybutton9.update();
    keybutton10.update();
    keybutton21.update();

    //Joystick buttons Falling
    if (keybutton0.fallingEdge()) {
    Joystick.button(1, 1);... Read more »

  • Update 2

    Toulon10/03/2014 at 23:39 0 comments

    After a bunch of trips to electronics stores and lots of new parts i have managed to rebuild the CLAW. The results so far are mixed. I feel that the buttons i got are a bit too stiff for my tastes. As well as the design is a bit too far from the stock keyboard WASD setup and therefore will need a bit of a learning curve. All in All this project has turned out well so far.

  • Update 1

    Toulon10/03/2014 at 23:38 0 comments

    Have made some new additions to the CLAW rebuild. Mainly software changes...

    1. Added Shift toggle for Minecraft <-- Safety
    2. Added Left mouse click toggle for Minecraft <-- Easy Mining
    3. Sprint button for Minecraft <-- Work in progress

View all 3 project logs

Enjoy this project?

Share

Discussions

Jasmine Brackett wrote 02/11/2015 at 04:59 point

Hey, your project was featured in this weeks hacklet and added to the minecraft list. 

http://hackaday.com/2015/02/06/hacklet-33-minecraft-projects/

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates