import RPi.GPIO as GPIO
import time, threading
in_gpios = [11, 12, 13, 15, 16, 22]
out_gpio = 32
def in_active(channel):
print(channel)
def init_gpios():
GPIO.setmode(GPIO.BOARD)
GPIO.setup(out_gpio, GPIO.OUT, initial=GPIO.LOW)
for i in in_gpios:
GPIO.setup(i, GPIO.IN)
GPIO.add_event_detect(i, GPIO.RISING)
GPIO.add_event_callback(i, callable=in_active)
def time_right():
GPIO.output(out_gpio, GPIO.HIGH)
time.sleep(0.5)
GPIO.output(out_gpio, GPIO.LOW)
if __name__ == '__main__':
init_gpios()
threading.Thread(target=time_right).start()