Created
September 5, 2020 17:02
-
-
Save piotr-piatkowski/720e46a6f4bf0939311db9c3707f7fff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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