January 3, 2024, 21:46
import RPi.GPIO as GPIO import threading def led_test(): while true: PIO.output(led_one, GPIO.HIGH) button_state = GPIO.input(bt_pin) if button_state == GPIO.LOW: PIO.output(led_one, GPIO.LOW) led_thread = threading.Thread(target=led_test) led_one = 24 led_two = 18 bt_pin = 27 GPIO.setmode(GPIO.BCM) GPIO.setup(bt_pin, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(led_one, GPIO.OUT) GPIO.setup(led_two, GPIO.OUT) PIO.output(led_two, GPIO.HIGH) led_thread.start()