Hello!
I’m new to coding and have been modifying old/broken guitar hero guitars. I wrote some simple code for the arduino micro to just activate buttons to keyboard keys here
#include "Keyboard.h"
void setup() {
Keyboard.begin();
//Joystick and button connections
pinMode(2, INPUT_PULLUP); //Green Button
pinMode(3, INPUT_PULLUP); //Red Button
pinMode(4, INPUT_PULLUP); //Yellow Button
pinMode(5, INPUT_PULLUP); //Blue Button
pinMode(6, INPUT_PULLUP); //Orange Button
pinMode(7, INPUT_PULLUP); //Strum up
pinMode(8, INPUT_PULLUP); //Strum Down
pinMode(9, INPUT_PULLUP); //Start
pinMode(10, INPUT_PULLUP); //Select
}
void loop() {
// Check the switches:
int buttonState2 = digitalRead(2);
int buttonState3 = digitalRead(3);
int buttonState4 = digitalRead(4);
int buttonState5 = digitalRead(5);
int buttonState6 = digitalRead(6);
int buttonState7 = digitalRead(7);
int buttonState8 = digitalRead(8);
int buttonState9 = digitalRead(9);
int buttonState10 = digitalRead(10);
// Green Button
if (buttonState2 == LOW) {
Keyboard.press(194);
}
else {
Keyboard.release(194);
}
// Red Button
if (buttonState3 == LOW) {
Keyboard.press(195);
}
else{
Keyboard.release(195);
}
// Yellow Button
if(buttonState4 == LOW) {
Keyboard.press(196);
}
else{
Keyboard.release(196);
}
// Blue Button
if (buttonState5 == LOW) {
Keyboard.press(197);
}
else{
Keyboard.release(197);
}
// Orange Button
if (buttonState6 == LOW) {
Keyboard.press(198);
}
else{
Keyboard.release(198);
}
// Strum Up
if (buttonState7 == LOW) {
Keyboard.press(133);
}
else{
Keyboard.release(133);
}
// Strum Down
if (buttonState8 == LOW) {
Keyboard.press(176);
}
else{
Keyboard.release(176);
}
// Start
if (buttonState9 == LOW) {
Keyboard.press(129);
}
else{
Keyboard.release(129);
}
// Select
if (buttonState10 == LOW) {
Keyboard.press(128);
}
else{
Keyboard.release(128);
}
}
I wanted to try and get the whammy bar working but i’m not sure how to go about getting this working. The whammy bar is attached to a spring and when pushed it turns a single turn encoder (not sure the exact name it turns around 85% or 90% and stop) so the game reads it as 30% back and forth movement as a slider of sorts.
if anyone can help me me with this section or if it’s even possible with a micro that would be great!