I' following this tutorial to have two buttons working with my Pi.

The code I have is the same:

import RPi.GPIO as GPIO


GPIO.setup(23, GPIO.IN, pull_up_down = GPIO.PUD_DOWN)
GPIO.setup(24, GPIO.IN, pull_up_down = GPIO.PUD_UP)

while True:
    if(GPIO.input(23) ==1):
       print(“Button 1 pressed”)
    if(GPIO.input(24) == 0):
       print(“Button 2 pressed”)


While I don't have any response from the #23, the Pi reboots itself when I press #24.

I'm using an Adafruit Assembled Pi T-Cobbler Breakout + Cable.

What am I doing wrong?

  • Are you sure, that the wiring at your breakout box is correct?
    – Ghanima
    Sep 30, 2014 at 22:33
  • 1
    Make sure your cobbler is inserted the right way around. If it's back to front you can cause damage, If the multiway cable has one coloured one check it goes pin1 to pin1.
    – joan
    Oct 1, 2014 at 5:55
  • Thanks @joan. Actually you were right: the cobbler was the other way round. This still puzzles me, as I followed the picture on the ADAfruit page. Therefore I think there is some sort of production mistake...
    – slwr
    Oct 1, 2014 at 10:51
  • 1
    The cobbler and cable should be keyed so that they only fit one way. If they are not keyed then I'd count that as a design error. Unfortunately the expansion header isn't keyed so there will be a right and a wrong way of inserting the cable over the pins.
    – joan
    Oct 1, 2014 at 11:00


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.