How to troubleshoot GPIO Zero?

518 views Asked by At

I'm trying to do a pretty basic 'get an LED' to blink tutorial with a Raspberry Pi Zero. Following this guide:

Blink: Making An LED Blink On A Raspberry Pi

I'm able to get the LED to turn on and off with the gpio command line utility, and the sample code for using RPi.GPIO works fine as well, but I can not get the GPIO Zero example to work.

from gpiozero import LED
from time import sleep

redLED = LED(21)

print "Press CTRL-C to exit."
try:
   while True:
      redLED.on()
      sleep(0.5)
      redLED.off()
      sleep(0.5)

finally:
   redLED.close()
   print "\nCompleted cleanup of GPIO resources."

The code executes with no errors, but the LED doesn't blink. What things can I try to troubleshoot likely problems?

Since the command line and the RPi.GPIO examples work, I'm sure the LED and resistor are wired up correctly, so I'm not sure what to try next.

0

There are 0 answers