I'm trying to connect this Toggle Switch to my Pi enter image description here

But I can't seem to get any input off it, It's connected to a GPIO pin and ground like I've done with Push Buttons in the past but it just doesn't work.

Any ideas?

  • We are going to need to see pictures of the rest of the connections and your code. Aug 6 '17 at 9:59
  • Do you have a way to test the switch without the Pi to rule it out as the problem? E.g. test with a ohm-meter or wire a LED with resistor and a power source via the switch.
    – Ghanima
    Aug 6 '17 at 11:37

It seems I had an error in my GPIO setup, I had the wrong GPIO.PUD_UP set.

GPIO.setup(LG_PIN, GPIO.IN, pull_up_down=GPIO.PUD_UP)

Working fine with the code above now :)

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.