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:
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?
1 Answer 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:
-
Sadly this pi is no longer in service so I can't test it.sir_ian– sir_ian2016年11月25日 21:33:32 +00:00Commented Nov 25, 2016 at 21:33
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