domotik/manage_gpio.py
2022-12-18 06:35:53 +01:00

24 lines
574 B
Python

from RPi import GPIO
import time
GPIO.setmode(GPIO.BOARD)
GPIO.setup(38, GPIO.OUT, initial=GPIO.LOW)
GPIO.setup(40, GPIO.OUT, initial=GPIO.LOW)
try:
while True:
GPIO.output(38, GPIO.LOW)
time.sleep(0.3)
GPIO.output(40, GPIO.HIGH)
time.sleep(0.3)
GPIO.output(40, GPIO.LOW)
time.sleep(0.3)
for _ in range(150):
GPIO.output(38, GPIO.HIGH)
time.sleep(0.002)
GPIO.output(38, GPIO.LOW)
time.sleep(0.2)
time.sleep(5)
except KeyboardInterrupt:
GPIO.cleanup()