SekolahRobot
Published © GPL3+

Retro Revival : Bring Back Childhood Memories (Guitar Hero)

Transforming a PS2 Guitar Hero Controller for Bluetooth PC Compatibility with ESP32.

BeginnerFull instructions provided12 hours270
Retro Revival : Bring Back Childhood Memories (Guitar Hero)

Things used in this project

Hardware components

Espressif ESP32 Development Board - Developer Edition
Espressif ESP32 Development Board - Developer Edition
ESP32 WEMOS
×1
Pushbutton Switch, Pushbutton
Pushbutton Switch, Pushbutton
push button guitar hero
×1
DC/DC Converter, Step Down
DC/DC Converter, Step Down
5V stepdown
×1
Li-Ion Battery 1000mAh
Li-Ion Battery 1000mAh
Battery 2 Cell
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Solder Wire, Lead Free
Solder Wire, Lead Free
Drill / Driver, Cordless
Drill / Driver, Cordless

Story

Read more

Schematics

Schematic Guitar Hero ESP32

Code

Test IO button guitar Hero

C/C++
/*
 * Test IO program for INPUT Button guitar Hero
 * SekolahRobot.co.id
 * Dhadhang SBW
 */

#define GH_GREEN 26
#define GH_RED 18
#define GH_YELLOW 19
#define GH_BLUE 33
#define GH_ORANGE 23
#define GH_SUP 21
#define GH_SDOWN 22

void setup() {
  Serial.begin(115200);
  pinMode(GH_GREEN, INPUT_PULLUP);
  pinMode(GH_RED, INPUT_PULLUP);
  pinMode(GH_YELLOW, INPUT_PULLUP);
  pinMode(GH_BLUE, INPUT_PULLUP);
  pinMode(GH_ORANGE, INPUT_PULLUP);
  pinMode(GH_SUP, INPUT_PULLUP);
  pinMode(GH_SDOWN, INPUT_PULLUP); 
}


void loop() {
  if (digitalRead(GH_GREEN) == LOW) {
        Serial.println("Button Green");
  }
  if (digitalRead(GH_RED) == LOW) {
        Serial.println("Button Red");
  }
  if (digitalRead(GH_YELLOW) == LOW) {
        Serial.println("Button Yellow");
  }
  if (digitalRead(GH_BLUE) == LOW) {
        Serial.println("Button Blue");
  }
  if (digitalRead(GH_ORANGE) == LOW) {
        Serial.println("Button Orange");
  }
  if (digitalRead(GH_SUP) == LOW) {
        Serial.println("Strum UP");
  }
  if (digitalRead(GH_SDOWN) == LOW) {
        Serial.println("Strum Down");
  }
}

BLE Controller guitar hero

C/C++
/*
 * BLE keyboard - Button guitar Hero
 * SekolahRobot.co.id
 * Dhadhang SBW
 */

#define USE_NIMBLE
#include <BleKeyboard.h>
BleKeyboard bleKeyboard("GuitarHero_BLE", "SRI24", 100);

#define GH_GREEN 26
#define GH_RED 18
#define GH_YELLOW 19
#define GH_BLUE 33
#define GH_ORANGE 23
#define GH_SUP 21
#define GH_SDOWN 22

bool keyStates[7] = {false, false, false, false, false, false, false};
int keyPins[7] = {GH_GREEN, GH_RED, GH_YELLOW, GH_BLUE, GH_ORANGE, GH_SUP, GH_SDOWN};
uint8_t keyKeyboard[7] = {'A', 'S', 'D', 'F', 'G', 'O', 'L'};


void setup() {
  Serial.begin(115200);
  Serial.println("Start BLE GuitarHero ...");
  pinMode(GH_GREEN, INPUT_PULLUP);
  pinMode(GH_RED, INPUT_PULLUP);
  pinMode(GH_YELLOW, INPUT_PULLUP);
  pinMode(GH_BLUE, INPUT_PULLUP);
  pinMode(GH_ORANGE, INPUT_PULLUP);
  pinMode(GH_SUP, INPUT_PULLUP);
  pinMode(GH_SDOWN, INPUT_PULLUP);
  bleKeyboard.begin();
}

bool connectNotification = false;

void loop() {
  int count;
  if(bleKeyboard.isConnected()) {
    if (!connectNotification) {
      Serial.println("Guitar Hero BLE connected...");
      connectNotification = true;
    }
    for(count = 0; count < 7; count ++){
      buttonHandle(count);
    }
  }
}


void buttonHandle(int keyIndex){
  if (!digitalRead(keyPins[keyIndex])){
    // if button pressed
    if (!keyStates[keyIndex]){
      // key not currently pressed
      keyStates[keyIndex] = true;
      bleKeyboard.press(keyKeyboard[keyIndex]);
    }
  }
  else {
    // if button not pressed
    if (keyStates[keyIndex]){
      // key currently pressed
      keyStates[keyIndex] = false;
      bleKeyboard.release(keyKeyboard[keyIndex]);
    }
  }
}

Credits

SekolahRobot
9 projects • 20 followers
Sekolah Robot Indonesia is non formal education in Indonesia to learning about robot, and base on Community

Comments