21 lines
373 B
Python
21 lines
373 B
Python
#!/usr/bin/python
|
|
|
|
import RPi.GPIO as GPIO
|
|
|
|
from time import sleep
|
|
|
|
GPIO.setmode(GPIO.BOARD)
|
|
GPIO.setup(15, GPIO.IN)
|
|
GPIO.setup(16, GPIO.IN)
|
|
GPIO.setup(18, GPIO.IN)
|
|
GPIO.setup(22, GPIO.OUT)
|
|
|
|
while True:
|
|
GPIO.output(22, GPIO.LOW)
|
|
sleep(1)
|
|
GPIO.output(22, GPIO.HIGH)
|
|
sleep(1)
|
|
if GPIO.input(16):
|
|
print("Pressed")
|
|
else:
|
|
print("Released") |