I am trying to do "LED Blink" with GPIO and Python on my RPi B+.
I am using my breakout board with a breadboard and am jumping pin 11 (GPIO 17) > resistor > LED > jump to pin 9 (GND). I am using the latest version of RPi.GPIO
.
Here's my python script:
import RPi.GPIO as GPIO
import time
# blinking function
def blink(pin):
GPIO.output(pin,GPIO.HIGH)
time.sleep(1)
GPIO.output(pin,GPIO.LOW)
time.sleep(1)
return
# to use Raspberry Pi board pin numbers
GPIO.setmode(GPIO.BOARD)
# set up GPIO output channel
GPIO.setup(11, GPIO.OUT)
# blink GPIO17 50 times
for i in range(0,50):
blink(11)
GPIO.cleanup()
Even before it runs, the LED is on. The script does not turn the LED off or on when run as sudo, and it gives me:
blink.py:13: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.
GPIO.setup(11, GPIO.OUT)
Images of my wiring:
Then the script executes without further error, but the LED stays on. What is happening? Can I reset GPIO? How do I fix this?
The script still will not turn on the LED. Why not?