import machine
import time
import _thread
# Define the pin numbers for the LEDs
LED1_PIN = 2
LED2_PIN = 4
# Define the delay time for the LEDs to blink
DELAY_TIME = 500
# Define the FreeRTOS tasks for the LEDs
def led1_task():
while True:
machine.Pin(LED1_PIN, machine.Pin.OUT).value(0)
machine.Pin(LED2_PIN, machine.Pin.OUT).value(1)
time.sleep_ms(DELAY_TIME)
def led2_task():
while True:
machine.Pin(LED1_PIN, machine.Pin.OUT).value(1)
machine.Pin(LED2_PIN, machine.Pin.OUT).value(0)
time.sleep_ms(DELAY_TIME)
# Start the FreeRTOS tasks for the LEDs
_thread.start_new_thread(led1_task, ())
_thread.start_new_thread(led2_task, ())