Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save piotr-piatkowski/720e46a6f4bf0939311db9c3707f7fff to your computer and use it in GitHub Desktop.
Save piotr-piatkowski/720e46a6f4bf0939311db9c3707f7fff to your computer and use it in GitHub Desktop.
import RPi.GPIO as GPIO
import time
import logging
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger('')
logger.setLevel(logging.DEBUG)
GPIO.setmode(GPIO.BCM)
pins = range(1, 28)
for p in pins:
print("GPIO{}".format(p), end=' ')
GPIO.setup(p, GPIO.IN, pull_up_down=GPIO.PUD_UP)
rup = GPIO.input(p)
print("UP={}".format(rup), end=' ')
GPIO.setup(p, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
rdn = GPIO.input(p)
print("DOWN={}".format(rdn), end=' ')
if rup and not rdn:
print("OK")
else:
print("FAIL")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment