4

I've been getting into GPIO recently with the GPIOZero library but when i first tried it today it completely failed. As my first foray into GPIO i set up a circuit to light up an LED with the push of a button, so simple nothing could go wrong, right? I imported the library like so: from gpiozero import Button, LED then i set up my components: led = LED(17) then the button: btn = Button(4) And then this happened:

enter image description here

I have attempted to re download the library but sudo apt-get install python3-gpiozero said that it was the latest version.

This is the circuit:

schematic

simulate this circuit – Schematic created using CircuitLab

First: what doe this error mean?

Second: How can i fix it?

asked Jun 3, 2016 at 13:48
4
  • It may be a bug. Try using sudo python to see if you still get the same error message. Commented Jun 3, 2016 at 14:39
  • @joan if i run sudo python3 and then enter in the python commands i get the error but if i save i file with the code it does nothing Commented Jun 3, 2016 at 15:07
  • The script works for me (with or without sudo). I'd guess you have an inconsistent version of the RPi.GPIO module. Commented Jun 3, 2016 at 15:57
  • @joan finally got around to experimenting with this some more and it does work with pins 27 and 17 and probably more more but just not with pin number @#%$^&$ 4 Commented Jun 22, 2016 at 18:23

1 Answer 1

1

I have seen this before, when the 1-wire interface has been enabled. If you've enabled 1-wire in Raspberry Pi configuration, you won't be able to use GPIO4 for general use. Try disabling it:

https://github.com/bennuttall/one-wire-temperature-sensor

answered Nov 24, 2016 at 15:26
1
  • Sadly this pi is no longer in service so I can't test it. Commented Nov 25, 2016 at 21:33

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.