0

I have build a musicbox with an rpi 3+ and added a power button and 2 buttons to turn the volume up and down.

The buttons have LED lighting, I have connected them to GPIO pins but this results in them being turned on all the time even if the pi is turned off. Power button is connected to pin 5 and 6 and then for the led power on the button is connected to ground and 5v pin.

Is there a way to setup the GPIO pins so the lighting only turns on when the pi is on? Thinking of some kind of code for the GPIO pins

  • How exactly have you got it connected? – Mark Smith Mar 2 at 16:12
  • Power button is connected to pin 5 and 6 and then for the led power on the button is connected to ground and 5v pin – Daniel Baumgart Mar 2 at 17:13
1

Your LED is connected to power pins which happen to be near to the GPIO pins. If you instead connect to actual GPIO pins, you can control it -- the internet is full of tutorials telling you how to connect and control an LED to GPIO pins, such as this one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.