March 31, 2024, 09:54
py import RPi.GPIO as GPIO pins = [18, 23, 24] pin_led_states = [ [1, 0, -1], # A [0, 1, -1], # B [-1, 1, 0], # C [-1, 0, 1], # D [1, -1, 0], # E [0, -1, 1] # F ] GPIO.setmode(GPIO.BCM) def set_pin(pin_index, pin_state): if pin_state == -1: GPIO.setup(pins[pin_index], GPIO.IN) else: GPIO.setup(pins[pin_index], GPIO.OUT) GPIO.output(pins[pin_index], pin_state) def light_led(led_number): for pin_index, pin_state in enumerate(pin_led_states[led_number]): set_pin(pin_index, pin_state) set_pin(0, -1) set_pin(1, -1) set_pin(2, -1) while True: x = int(input("Pin (0 to 5):")) light_led(x)and i would like someone who understands better than me to help convert it to gpiod the gpiod documantation is a mess. Your help will be appreciated!