Homepage Forums RetroPie Project New to RetroPie? Start Here! Illuminated Buttons – Selective Illumination Reply To: Illuminated Buttons – Selective Illumination

#95790
khayman
Participant

So this is possible in theory (I haven’t tried this so YMMV). I’ve been sort of noodling on it since I saw this yesterday (couldn’t sleep last night and was in my workshop playing with stuff) and I think I have a way you might be able to make it happen.

LED equipped buttons have 4 connectors: a signal and ground for the switch + a pos and neg for the LED. EmulationStation allows you to specify your launch commands and in doing so you could inject appropriate code (google sending commands using python from raspberry pi GPIO boards).

How I’d do it (again, in the process of building this it would likely change as I figured out what didn’t work). I would set up base configurations and plan those out. Let’s say I had (for argument’s sake) six buttons in a classic 3 columns, two rows layout. Number then 1, 2, 3 across the top row… 4, 5, 6 on the next line. Then figure out the configurations:
NES: 1 & 2
Atari: 1
SNES: 1 & 2 & 3 & 4 & 5 & 6
etc…

I’m not sure if the GPIO pins on the raspberry pi could drive enough power without causing a drain elsewhere to run all of them (again, they might… might not). So I might consider hooking up my Arduino to my pi, let my pi send the command and write scripts into the Arduino to receive the commands to turn on/off the LEDs. LEDs are connected into the Arduino. It would take some tinkering and you’d want to build the appropriate circuits on a breadboard. Your Arduino script might be something along the lines (again, not testing this or really checking it as I’m at work right now… just sort of one-offing it):

void setup() {
   Serial.begin(9600); // or whatever it needs to be between the two
}

void loop() {
   if (Serial.available() > 0) {
      int command = Serial.read();  // get our command
   
      if (command == 1) {  // Atari
         lightupAtari();
      }
      if (command == 2) { //or whatever 
      }
   }
}

void lightupAtari() {
   digitalWrite(13, HIGH);  //assuming pin 13 is hooked up to drive button 1
}

void lightupNes() {
   //write out your commands for lighting the appropriate buttons.
   //it might be good to chain several buttons to one pin if you can 
   //and think about them in groups.
}

void lightsForES() {
   digitalWrite(13, LOW);
   // and all of your other pins, make sure to turn them off.
}