from machine import Pin, PWM
import time
# Define GPIO pins for the LEDs
led_pins = [17, 16, 15, 14]
leds = [PWM(Pin(pin)) for pin in led_pins]
# Function to set LED brightness
def set_brightness(duty_cycle):
for led in leds:
led.duty_u16(int(duty_cycle * 65535 / 100))
# Simulating command input
while True:
command = input("Enter command (off, 25, 50, 75, 100): ").strip()
if command == "off":
set_brightness(0)
elif command == "25":
set_brightness(25)
elif command == "50":
set_brightness(50)
elif command == "75":
set_brightness(75)
elif command == "100":
set_brightness(100)
else:
print("Invalid command")