Project showcase
Keyboard and Mouse Controller

Keyboard and Mouse Controller © GPL3+

Hack an old controller and use it as a combination of a keyboard and a mouse.

  • 2,574 views
  • 0 comments
  • 3 respects

Components and supplies

Necessary tools and machines

09507 01
Soldering iron (generic)

About this project

I had a cheap and old controller that I did not use anymore. I wanted to find out, if I can make it into a combination of a keyboard and a mouse with the help of an Arduino Micro. This way the controller can be recognized by any PC without any drivers and you can easily reprogram it, to have different modes for different games. (And of course as with so many things I made it and it is collecting dust on the shelf without being used.)

Important: If you try to replicate this project, know that you will not have the original controller in one piece and it will not work as original after the modifications.

I managed to find enough inputs on the micro after some search, and I could make it work. I could handle 20 buttons and 4 axes and 1 output for an LED.

C:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\leonardo contains a file, in which you can see, that MISO, MOSI, SCK and SS pins can be used as digital pins 14-17. Also I was able to use the Tx LED output to control my LED. I had to desolder the original Tx SMD LED and solder mine there. (If you can't figure this out from these informations and the schematics, don't try to replicate this part.)

#define LED_BUILTIN_TX 30
#define PIN_SPI_SS    (17)
#define PIN_SPI_MOSI  (16)
#define PIN_SPI_MISO  (14)
#define PIN_SPI_SCK   (15)

I was lucky enough with this simple Ewent controller, that it had enough free space inside to fit the micro. I had to remove the vibrating motors to have enough space.

I had to scrape off the copper conductor around the original blob chip and around the buttons. I will not give detailed description on this, as all controllers are different. One side of all the buttons was already connected, so I connected that to GND of the micro. This way I could use input pullup on all inputs. The other pin of the buttons are connected to the micro.

I had to connect 5V and GND to the 4 joysticks, and use their middle pin with analog read.

I also connected a "rainbow" LED to the 5V, so it is always changing colors.

The program

The program has 3 modes. The default is surfing mode, with mouse and functional keys. The second mode is writing mode. You can type in letters in the style of the old phones. And the third mode is a test mode, which writes one character for each button pressed. You can change the mouse sensitivity and use the mouse wheel.

Code

Keyboard controllerC/C++
This is the code for the keyboard and mouse controller.
/*
 * 
 * Keyboard and Mouse controller
 * some comments might be in hungarian, sorry
 * Peter Dio 2017
 * 
 */
#define BA 5  // Button A
#define BB 6  // Button B
#define BX 8  // Button X
#define BY 7  // Button Y

#define BU 23 // Button Up
#define BD 0  // Button Down
#define BL 2  // Button Left
#define BR 15 // Button Right

#define BL1 11  // Button Left 1
#define BR1 3   // Button Right 1
#define BL2 12  // Button Left 2
#define BR2 4   // Button Right 2
#define BLS 13  // Button Left Stick
#define BRS 22  // Button Right Stick

#define BMODE 1     // Button Mode
#define BSTART 10   // Button Start
#define BSELECT 16  // Button Select
#define BAUTO 9     // Button Auto
#define BTURBO 14   // Button Turbo
#define BCLEAR 17   // Button Clear

#define SLX 21  // Stick Left X
#define SLY 20  // Stick Left Y
#define SRX 19  // Stick Right X
#define SRY 18  // Stick Right Y

#include "Keyboard.h"
#include "Mouse.h"

int mode = 0,     // Segédváltozó
    nr_modes = 3, // Number of modes
    aSLX,         // Analog beolvasás
    aSLY,         // Analog beolvasás
    aSRX,         // Analog beolvasás
    aSRY,         // Analog beolvasás
    sense = 3;    // Mouse sensitivity 1-5
//============================================================================================================================================================================================================
void setup() {
  pinMode(BA, INPUT_PULLUP);
  pinMode(BB, INPUT_PULLUP);
  pinMode(BX, INPUT_PULLUP);
  pinMode(BY, INPUT_PULLUP);
  pinMode(BU, INPUT_PULLUP);
  pinMode(BD, INPUT_PULLUP);
  pinMode(BL, INPUT_PULLUP);
  pinMode(BR, INPUT_PULLUP);
  pinMode(BL1, INPUT_PULLUP);
  pinMode(BR1, INPUT_PULLUP);
  pinMode(BL2, INPUT_PULLUP);
  pinMode(BR2, INPUT_PULLUP);
  pinMode(BLS, INPUT_PULLUP);
  pinMode(BRS, INPUT_PULLUP);
  pinMode(BMODE, INPUT_PULLUP);
  pinMode(BSTART, INPUT_PULLUP);
  pinMode(BSELECT, INPUT_PULLUP);
  pinMode(BAUTO, INPUT_PULLUP);
  pinMode(BTURBO, INPUT_PULLUP);
  pinMode(BCLEAR, INPUT_PULLUP);
  pinMode(SLX, INPUT);
  pinMode(SLY, INPUT);
  pinMode(SRX, INPUT);
  pinMode(SRY, INPUT);
  pinMode(30, INPUT);
  Keyboard.begin();
  Mouse.begin();
}
//============================================================================================================================================================================================================
void loop() {
  if(mode >= (nr_modes)){
    mode = 0;
  }
//============================================================================================================================================================================================================
  ///////////////////////////////////////////////////////////// MODE 2
  if(mode == 2){
    digitalWrite(30, 1);
    
    if(digitalRead(BA) == LOW){//////////////////////////////// ABXY
      Keyboard.press('a');
    }
    if(digitalRead(BA) == HIGH){
      Keyboard.release('a');
    }
    if(digitalRead(BB) == LOW){
      Keyboard.press('b');
    }
    if(digitalRead(BB) == HIGH){
      Keyboard.release('b');
    }
    if(digitalRead(BX) == LOW){
      Keyboard.press('x');
    }
    if(digitalRead(BX) == HIGH){
      Keyboard.release('x');
    }
    if(digitalRead(BY) == LOW){
      Keyboard.press('y');
    }
    if(digitalRead(BY) == HIGH){
      Keyboard.release('y');
    }
    
    if(digitalRead(BU) == LOW){//////////////////////////////// UDLR
      Keyboard.press('u');
    }
    if(digitalRead(BU) == HIGH){
      Keyboard.release('u');
    }
    if(digitalRead(BD) == LOW){
      Keyboard.press('d');
    }
    if(digitalRead(BD) == HIGH){
      Keyboard.release('d');
    }
    if(digitalRead(BL) == LOW){
      Keyboard.press('l');
    }
    if(digitalRead(BL) == HIGH){
      Keyboard.release('l');
    }
    if(digitalRead(BR) == LOW){
      Keyboard.press('r');
    }
    if(digitalRead(BR) == HIGH){
      Keyboard.release('r');
    }

    if(digitalRead(BL1) == LOW){/////////////////////////////// 123456
      Keyboard.press('1');
    }
    if(digitalRead(BL1) == HIGH){
      Keyboard.release('1');
    }
    if(digitalRead(BR1) == LOW){
      Keyboard.press('2');
    }
    if(digitalRead(BR1) == HIGH){
      Keyboard.release('2');
    }
    if(digitalRead(BL2) == LOW){
      Keyboard.press('3');
    }
    if(digitalRead(BL2) == HIGH){
      Keyboard.release('3');
    }
    if(digitalRead(BR2) == LOW){
      Keyboard.press('4');
    }
    if(digitalRead(BR2) == HIGH){
      Keyboard.release('4');
    }
    if(digitalRead(BLS) == LOW){
      Keyboard.press('5');
    }
    if(digitalRead(BLS) == HIGH){
      Keyboard.release('5');
    }
    if(digitalRead(BRS) == LOW){
      Keyboard.press('6');
    }
    if(digitalRead(BRS) == HIGH){
      Keyboard.release('6');
    }

    if(digitalRead(BSTART) == LOW){//////////////////////////// FUNCTION KEYS
      Keyboard.press('s');
    }
    if(digitalRead(BSTART) == HIGH){
      Keyboard.release('s');
    }
    if(digitalRead(BSELECT) == LOW){
      Keyboard.press('e');
    }
    if(digitalRead(BSELECT) == HIGH){
      Keyboard.release('e');
    }
    if(digitalRead(BAUTO) == LOW){
      Keyboard.press('o');
    }
    if(digitalRead(BAUTO) == HIGH){
      Keyboard.release('o');
    }
    if(digitalRead(BTURBO) == LOW){
      Keyboard.press('t');
    }
    if(digitalRead(BTURBO) == HIGH){
      Keyboard.release('t');
    }
    pinMode(BCLEAR, INPUT_PULLUP);
    if(digitalRead(BCLEAR) == LOW){
      Keyboard.press('c');
    }
    pinMode(BCLEAR, INPUT_PULLUP);
    if(digitalRead(BCLEAR) == HIGH){
      Keyboard.release('c');
    }
    if(digitalRead(BMODE) == LOW){//////////////////////////// MODE SELECTION
      mode++;
      digitalWrite(30, 0);
      delay(100);
      digitalWrite(30, 1);
      delay(200);
    }
  }
  ///////////////////////////////////////////////////////////// MODE 2
//============================================================================================================================================================================================================
  ///////////////////////////////////////////////////////////// MODE 0
  if(mode==0){
    if(sense >= 6){
      sense = 1;
    }
    digitalWrite(30, 1);
    
    if(digitalRead(BA) == LOW){//////////////////////////////// ABXY
      Mouse.press();
    }
    if(digitalRead(BA) == HIGH){
      Mouse.release();
    }
    if(digitalRead(BB) == LOW){
      Mouse.press(2);
    }
    if(digitalRead(BB) == HIGH){
      Mouse.release(2);
    }
    if(digitalRead(BX) == LOW){
      Keyboard.press(KEY_RETURN);
    }
    if(digitalRead(BX) == HIGH){
      Keyboard.release(KEY_RETURN);
    }
    if(digitalRead(BY) == LOW){
      Keyboard.press(KEY_BACKSPACE);
    }
    if(digitalRead(BY) == HIGH){
      Keyboard.release(KEY_BACKSPACE);
    }
    
    if(digitalRead(BU) == LOW){//////////////////////////////// UDLR
      Keyboard.press(KEY_UP_ARROW);
    }
    if(digitalRead(BU) == HIGH){
      Keyboard.release(KEY_UP_ARROW);
    }
    if(digitalRead(BD) == LOW){
      Keyboard.press(KEY_DOWN_ARROW);
    }
    if(digitalRead(BD) == HIGH){
      Keyboard.release(KEY_DOWN_ARROW);
    }
    if(digitalRead(BL) == LOW){
      Keyboard.press(KEY_LEFT_ARROW);
    }
    if(digitalRead(BL) == HIGH){
      Keyboard.release(KEY_LEFT_ARROW);
    }
    if(digitalRead(BR) == LOW){
      Keyboard.press(KEY_RIGHT_ARROW);
    }
    if(digitalRead(BR) == HIGH){
      Keyboard.release(KEY_RIGHT_ARROW);
    }
    
    if(digitalRead(BL1) == LOW){/////////////////////////////// 123456
      Keyboard.press(KEY_LEFT_SHIFT);
    }
    if(digitalRead(BL1) == HIGH){
      Keyboard.release(KEY_LEFT_SHIFT);
    }
    if(digitalRead(BR1) == LOW){
      Keyboard.press(KEY_RIGHT_ALT);
    }
    if(digitalRead(BR1) == HIGH){
      Keyboard.release(KEY_RIGHT_ALT);
    }
    if(digitalRead(BL2) == LOW){
      Keyboard.press(KEY_LEFT_CTRL);
    }
    if(digitalRead(BL2) == HIGH){
      Keyboard.release(KEY_LEFT_CTRL);
    }
    if(digitalRead(BR2) == LOW){
      Keyboard.press(' ');
    }
    if(digitalRead(BR2) == HIGH){
      Keyboard.release(' ');
    }
    if(digitalRead(BLS) == LOW){
      sense++;
      delay(200);
    }
    if(digitalRead(BRS) == LOW){
      Mouse.press(4);
    }
    if(digitalRead(BRS) == HIGH){
      Mouse.release(4);
    }

    if(digitalRead(BSTART) == LOW){//////////////////////////// FUNCTION KEYS
      Keyboard.press(KEY_ESC);
    }
    if(digitalRead(BSTART) == HIGH){
      Keyboard.release(KEY_ESC);
    }
    if(digitalRead(BSELECT) == LOW){
      Keyboard.press(KEY_LEFT_GUI);
    }
    if(digitalRead(BSELECT) == HIGH){
      Keyboard.release(KEY_LEFT_GUI);
    }
    pinMode(BCLEAR, INPUT_PULLUP);
    if(digitalRead(BCLEAR) == LOW){
      Keyboard.press(KEY_LEFT_ALT);
      delay(100);
      Keyboard.press(KEY_F4);
      delay(100);
      Keyboard.release(KEY_F4);
      Keyboard.release(KEY_LEFT_ALT);
      delay(100);
    }
    
    if(digitalRead(BMODE) == LOW){//////////////////////////// MODE SELECTION
      mode++;
      digitalWrite(30, 0);
      delay(100);
      digitalWrite(30, 1);
      delay(100);
      digitalWrite(30, 0);
      delay(100);
    }
    
    aSLX = analogRead(SLX);/////////////////////////////////////// CURSOR AND WHEEL
    aSLY = analogRead(SLY);
    //aSRX = analogRead(SRX);
    aSRY = analogRead(SRY);
    
    if(aSLX >= 509){/////////////////////////////////////// CURSOR X
      if(aSLX >= 600){
        if(aSLX >= 900){
          Mouse.move(-2*sense, 0, 0);
        }
        else{
          Mouse.move(-1*sense, 0, 0);
        }
      }
      else{
        Mouse.move(-1, 0, 0);
      }
    }
    if(aSLX <= 501){
      if(aSLX <= 400){
        if(aSLX <= 100){
          Mouse.move(2*sense, 0, 0);
        }
        else{
          Mouse.move(sense, 0, 0);
        }
      }
      else{
        Mouse.move(1, 0, 0);
      }
    }
    
    if(aSLY >= 526){ ////////////////////////////////////// CURSOR Y
      if(aSLY >= 600){
        if(aSLY >= 900){
          Mouse.move(0, -2*sense, 0);
        }
        else{
          Mouse.move(0, -1*sense, 0);
        }
      }
      else{
        Mouse.move(0, -1, 0);
      }
    }
    if(aSLY <= 518){
      if(aSLY <= 400){
        if(aSLY <= 100){
          Mouse.move(0, 2*sense, 0);
        }
        else{
          Mouse.move(0, 1*sense, 0);
        }
      }
      else{
        Mouse.move(0, 1, 0);
      }
    }
    
    if(aSRY >= 519){/////////////////////////////////// WHEEL
      if(aSRY >= 600){
        if(aSRY >= 900){
          Mouse.move(0, 0, 1);
          delay(50);
        }
        else{
          Mouse.move(0, 0, 1);
          delay(100);
        }
      }
      else{
        Mouse.move(0, 0, 1);
        delay(200);
      }
    }
    if(aSRY <= 511){
      if(aSRY <= 400){
        if(aSRY <= 100){
          Mouse.move(0, 0, -1);
          delay(50);
        }
        else{
          Mouse.move(0, 0, -1);
          delay(100);
        }
      }
      else{
        Mouse.move(0, 0, -1);
        delay(200);
      }
    }
  }
  ///////////////////////////////////////////////////////////// MODE 0
//============================================================================================================================================================================================================
  ///////////////////////////////////////////////////////////// MODE 1
  if(mode == 1){
    unsigned long pmillis,
                  cmillis;

    digitalWrite(30, 1);
    
    if(digitalRead(BMODE) == LOW){//////////////////////////// MODE SELECTION
      mode++;
      digitalWrite(30, 0);
      delay(100);
      digitalWrite(30, 1);
      delay(100);
      digitalWrite(30, 0);
      delay(100);
      digitalWrite(30, 1);
      delay(100);
      digitalWrite(30, 0);
      delay(100);
    }

    if(digitalRead(BU) == LOW){//////////////////////////////// UDLR
      Keyboard.press(KEY_BACKSPACE);
    }
    if(digitalRead(BU) == HIGH){
      Keyboard.release(KEY_BACKSPACE);
    }
    if(digitalRead(BR) == LOW){
      Keyboard.press(KEY_RETURN);
    }
    if(digitalRead(BR) == HIGH){
      Keyboard.release(KEY_RETURN);
    }

    if(digitalRead(BL1) == LOW){/////////////////////////////// 123456
      Keyboard.press(KEY_LEFT_SHIFT);
    }
    if(digitalRead(BL1) == HIGH){
      Keyboard.release(KEY_LEFT_SHIFT);
    }
    if(digitalRead(BR2) == LOW){
      Keyboard.press(' ');
    }
    if(digitalRead(BR2) == HIGH){
      Keyboard.release(' ');
    }

    if(digitalRead(BSTART) == LOW){//////////////////////////// FUNCTION KEYS
      Keyboard.press(KEY_ESC);
    }
    if(digitalRead(BSTART) == HIGH){
      Keyboard.release(KEY_ESC);
    }
    if(digitalRead(BSELECT) == LOW){
      Keyboard.press(KEY_LEFT_GUI);
    }
    if(digitalRead(BSELECT) == HIGH){
      Keyboard.release(KEY_LEFT_GUI);
    }
    pinMode(BCLEAR, INPUT_PULLUP);
    if(digitalRead(BCLEAR) == LOW){
      Keyboard.press(KEY_LEFT_ALT);
      delay(100);
      Keyboard.press(KEY_F4);
      delay(100);
      Keyboard.release(KEY_F4);
      Keyboard.release(KEY_LEFT_ALT);
      delay(100);
    }
    
    comehere:
    
    if(digitalRead(BA) == LOW){/////////////////////////////// ABCD
      pmillis = millis();
      cmillis = pmillis;
      while(digitalRead(BA) == LOW){
        delay(1);
      }
      while(digitalRead(BA) == HIGH){
        cmillis = millis();
        if(cmillis - pmillis >= 500){
          Keyboard.write('a');
          goto comehere;
        }
      }
      pmillis = cmillis;
      while(digitalRead(BA) == LOW){
        delay(1);
      }
      while(digitalRead(BA) == HIGH){
        cmillis = millis();
        if(cmillis - pmillis >= 500){
          Keyboard.write('b');
          goto comehere;
        }
      }
      pmillis = cmillis;
      while(digitalRead(BA) == LOW){
        delay(1);
      }
      while(digitalRead(BA) == HIGH){
        cmillis = millis();
        if(cmillis - pmillis >= 500){
          Keyboard.write('c');
          goto comehere;
        }
      }
      pmillis = cmillis;
      while(digitalRead(BA) == LOW){
        delay(1);
      }
      while(digitalRead(BA) == HIGH){
        cmillis = millis();
        if(cmillis - pmillis >= 500){
          Keyboard.write('d');
          goto comehere;
        }
      }
      goto comehere;
    }

    if(digitalRead(BB) == LOW){/////////////////////////////// EFGH
      pmillis = millis();
      cmillis = pmillis;
      while(digitalRead(BB) == LOW){
        delay(1);
      }
      while(digitalRead(BB) == HIGH){
        cmillis = millis();
        if(cmillis - pmillis >= 500){
          Keyboard.write('e');
          goto comehere;
        }
      }
      pmillis = cmillis;
      while(digitalRead(BB) == LOW){
        delay(1);
      }
      while(digitalRead(BB) == HIGH){
        cmillis = millis();
        if(cmillis - pmillis >= 500){
          Keyboard.write('f');
          goto comehere;
        }
      }
      pmillis = cmillis;
      while(digitalRead(BB) == LOW){
        delay(1);
      }
      while(digitalRead(BB) == HIGH){
        cmillis = millis();
        if(cmillis - pmillis >= 500){
          Keyboard.write('g');
          goto comehere;
        }
      }
      pmillis = cmillis;
      while(digitalRead(BB) == LOW){
        delay(1);
      }
      while(digitalRead(BB) == HIGH){
        cmillis = millis();
        if(cmillis - pmillis >= 500){
          Keyboard.write('h');
          goto comehere;
        }
      }
      goto comehere;
    }

    if(digitalRead(BX) == LOW){/////////////////////////////// IJKL
      pmillis = millis();
      cmillis = pmillis;
      while(digitalRead(BX) == LOW){
        delay(1);
      }
      while(digitalRead(BX) == HIGH){
        cmillis = millis();
        if(cmillis - pmillis >= 500){
          Keyboard.write('i');
          goto comehere;
        }
      }
      pmillis = cmillis;
      while(digitalRead(BX) == LOW){
        delay(1);
      }
      while(digitalRead(BX) == HIGH){
        cmillis = millis();
        if(cmillis - pmillis >= 500){
          Keyboard.write('j');
          goto comehere;
        }
      }
      pmillis = cmillis;
      while(digitalRead(BX) == LOW){
        delay(1);
      }
      while(digitalRead(BX) == HIGH){
        cmillis = millis();
        if(cmillis - pmillis >= 500){
          Keyboard.write('k');
          goto comehere;
        }
      }
      pmillis = cmillis;
      while(digitalRead(BX) == LOW){
        delay(1);
      }
      while(digitalRead(BX) == HIGH){
        cmillis = millis();
        if(cmillis - pmillis >= 500){
          Keyboard.write('l');
          goto comehere;
        }
      }
      goto comehere;
    }

    if(digitalRead(BY) == LOW){/////////////////////////////// MNOP
      pmillis = millis();
      cmillis = pmillis;
      while(digitalRead(BY) == LOW){
        delay(1);
      }
      while(digitalRead(BY) == HIGH){
        cmillis = millis();
        if(cmillis - pmillis >= 500){
          Keyboard.write('m');
          goto comehere;
        }
      }
      pmillis = cmillis;
      while(digitalRead(BY) == LOW){
        delay(1);
      }
      while(digitalRead(BY) == HIGH){
        cmillis = millis();
        if(cmillis - pmillis >= 500){
          Keyboard.write('n');
          goto comehere;
        }
      }
      pmillis = cmillis;
      while(digitalRead(BY) == LOW){
        delay(1);
      }
      while(digitalRead(BY) == HIGH){
        cmillis = millis();
        if(cmillis - pmillis >= 500){
          Keyboard.write('o');
          goto comehere;
        }
      }
      pmillis = cmillis;
      while(digitalRead(BY) == LOW){
        delay(1);
      }
      while(digitalRead(BY) == HIGH){
        cmillis = millis();
        if(cmillis - pmillis >= 500){
          Keyboard.write('p');
          goto comehere;
        }
      }
      goto comehere;
    }

    if(digitalRead(BD) == LOW){/////////////////////////////// QRST
      pmillis = millis();
      cmillis = pmillis;
      while(digitalRead(BD) == LOW){
        delay(1);
      }
      while(digitalRead(BD) == HIGH){
        cmillis = millis();
        if(cmillis - pmillis >= 500){
          Keyboard.write('q');
          goto comehere;
        }
      }
      pmillis = cmillis;
      while(digitalRead(BD) == LOW){
        delay(1);
      }
      while(digitalRead(BD) == HIGH){
        cmillis = millis();
        if(cmillis - pmillis >= 500){
          Keyboard.write('r');
          goto comehere;
        }
      }
      pmillis = cmillis;
      while(digitalRead(BD) == LOW){
        delay(1);
      }
      while(digitalRead(BD) == HIGH){
        cmillis = millis();
        if(cmillis - pmillis >= 500){
          Keyboard.write('s');
          goto comehere;
        }
      }
      pmillis = cmillis;
      while(digitalRead(BD) == LOW){
        delay(1);
      }
      while(digitalRead(BD) == HIGH){
        cmillis = millis();
        if(cmillis - pmillis >= 500){
          Keyboard.write('t');
          goto comehere;
        }
      }
      goto comehere;
    }

    if(digitalRead(BL) == LOW){/////////////////////////////// UVWXYZ
      pmillis = millis();
      cmillis = pmillis;
      while(digitalRead(BL) == LOW){
        delay(1);
      }
      while(digitalRead(BL) == HIGH){
        cmillis = millis();
        if(cmillis - pmillis >= 500){
          Keyboard.write('u');
          goto comehere;
        }
      }
      pmillis = cmillis;
      while(digitalRead(BL) == LOW){
        delay(1);
      }
      while(digitalRead(BL) == HIGH){
        cmillis = millis();
        if(cmillis - pmillis >= 500){
          Keyboard.write('v');
          goto comehere;
        }
      }
      pmillis = cmillis;
      while(digitalRead(BL) == LOW){
        delay(1);
      }
      while(digitalRead(BL) == HIGH){
        cmillis = millis();
        if(cmillis - pmillis >= 500){
          Keyboard.write('w');
          goto comehere;
        }
      }
      pmillis = cmillis;
      while(digitalRead(BL) == LOW){
        delay(1);
      }
      while(digitalRead(BL) == HIGH){
        cmillis = millis();
        if(cmillis - pmillis >= 500){
          Keyboard.write('x');
          goto comehere;
        }
      }
      pmillis = cmillis;
      while(digitalRead(BL) == LOW){
        delay(1);
      }
      while(digitalRead(BL) == HIGH){
        cmillis = millis();
        if(cmillis - pmillis >= 500){
          Keyboard.write('z');                    // ez lesz az y
          goto comehere;
        }
      }
      pmillis = cmillis;
      while(digitalRead(BL) == LOW){
        delay(1);
      }
      while(digitalRead(BL) == HIGH){
        cmillis = millis();
        if(cmillis - pmillis >= 500){
          Keyboard.write('y');                    // ez lesz a z
          goto comehere;
        }
      }
      goto comehere;
    }

    if(digitalRead(BR1) == LOW){/////////////////////////////// ,.?!
      pmillis = millis();
      cmillis = pmillis;
      while(digitalRead(BR1) == LOW){
        delay(1);
      }
      while(digitalRead(BR1) == HIGH){
        cmillis = millis();
        if(cmillis - pmillis >= 500){
          Keyboard.write(',');             // ,
          goto comehere;
        }
      }
      pmillis = cmillis;
      while(digitalRead(BR1) == LOW){
        delay(1);
      }
      while(digitalRead(BR1) == HIGH){
        cmillis = millis();
        if(cmillis - pmillis >= 500){
          Keyboard.write('.');             // .
          goto comehere;
        }
      }
      pmillis = cmillis;
      while(digitalRead(BR1) == LOW){
        delay(1);
      }
      while(digitalRead(BR1) == HIGH){
        cmillis = millis();
        if(cmillis - pmillis >= 500){
          Keyboard.write(60);            // ?
          goto comehere;
        }
      }
      pmillis = cmillis;
      while(digitalRead(BR1) == LOW){
        delay(1);
      }
      while(digitalRead(BR1) == HIGH){
        cmillis = millis();
        if(cmillis - pmillis >= 500){
          Keyboard.write(36);            // !
          goto comehere;
        }
      }
      goto comehere;
    }

    if(digitalRead(BTURBO) == LOW){/////////////////////////////// 12345
      pmillis = millis();
      cmillis = pmillis;
      while(digitalRead(BTURBO) == LOW){
        delay(1);
      }
      while(digitalRead(BTURBO) == HIGH){
        cmillis = millis();
        if(cmillis - pmillis >= 500){
          Keyboard.write('1');
          goto comehere;
        }
      }
      pmillis = cmillis;
      while(digitalRead(BTURBO) == LOW){
        delay(1);
      }
      while(digitalRead(BTURBO) == HIGH){
        cmillis = millis();
        if(cmillis - pmillis >= 500){
          Keyboard.write('2');
          goto comehere;
        }
      }
      pmillis = cmillis;
      while(digitalRead(BTURBO) == LOW){
        delay(1);
      }
      while(digitalRead(BTURBO) == HIGH){
        cmillis = millis();
        if(cmillis - pmillis >= 500){
          Keyboard.write('3');
          goto comehere;
        }
      }
      pmillis = cmillis;
      while(digitalRead(BTURBO) == LOW){
        delay(1);
      }
      while(digitalRead(BTURBO) == HIGH){
        cmillis = millis();
        if(cmillis - pmillis >= 500){
          Keyboard.write('4');
          goto comehere;
        }
      }
      pmillis = cmillis;
      while(digitalRead(BTURBO) == LOW){
        delay(1);
      }
      while(digitalRead(BTURBO) == HIGH){
        cmillis = millis();
        if(cmillis - pmillis >= 500){
          Keyboard.write('5');
          goto comehere;
        }
      }
      goto comehere;
    }

    if(digitalRead(BAUTO) == LOW){/////////////////////////////// 67890
      pmillis = millis();
      cmillis = pmillis;
      while(digitalRead(BAUTO) == LOW){
        delay(1);
      }
      while(digitalRead(BAUTO) == HIGH){
        cmillis = millis();
        if(cmillis - pmillis >= 500){
          Keyboard.write('6');
          goto comehere;
        }
      }
      pmillis = cmillis;
      while(digitalRead(BAUTO) == LOW){
        delay(1);
      }
      while(digitalRead(BAUTO) == HIGH){
        cmillis = millis();
        if(cmillis - pmillis >= 500){
          Keyboard.write('7');
          goto comehere;
        }
      }
      pmillis = cmillis;
      while(digitalRead(BAUTO) == LOW){
        delay(1);
      }
      while(digitalRead(BAUTO) == HIGH){
        cmillis = millis();
        if(cmillis - pmillis >= 500){
          Keyboard.write('8');
          goto comehere;
        }
      }
      pmillis = cmillis;
      while(digitalRead(BAUTO) == LOW){
        delay(1);
      }
      while(digitalRead(BAUTO) == HIGH){
        cmillis = millis();
        if(cmillis - pmillis >= 500){
          Keyboard.write('9');
          goto comehere;
        }
      }
      pmillis = cmillis;
      while(digitalRead(BAUTO) == LOW){
        delay(1);
      }
      while(digitalRead(BAUTO) == HIGH){
        cmillis = millis();
        if(cmillis - pmillis >= 500){
          Keyboard.write(96);
          goto comehere;
        }
      }
      goto comehere;
    }
    
    if(digitalRead(BLS) == LOW){//////////////////////////////// MOUSE CLICKS
      Mouse.press();
    }
    if(digitalRead(BLS) == HIGH){
      Mouse.release();
    }
    if(digitalRead(BRS) == LOW){
      Mouse.press(2);
    }
...

This file has been truncated, please download it to see its full contents.

Comments

Similar projects you might like

Head Mouse With MPU6050 and Arduino Micro

Project in progress by Gabry295

  • 14,920 views
  • 5 comments
  • 29 respects

A Pocket-Sized Touch Keyboard

Project tutorial by Amal Mathew

  • 3,587 views
  • 3 comments
  • 15 respects

Ternary Chord Keyboard

Project tutorial by Mr_Glenn

  • 3,473 views
  • 4 comments
  • 9 respects

How to Make a Customizable Punchable Keyboard Button

Project tutorial by Amal Mathew

  • 3,660 views
  • 7 comments
  • 9 respects

Portable MIDI BLE Keyboard

Project showcase by pianodevoyage

  • 3,397 views
  • 0 comments
  • 18 respects

Cthulhinho: A MIDI Controller

Project showcase by primvla

  • 2,778 views
  • 2 comments
  • 17 respects
Add projectSign up / Login