from machine import Pin
from time import sleep

led1 = Pin(2, Pin.OUT)
led2 = Pin(4, Pin.OUT)

while True :
    led1.on()
    led2.off()
    sleep(0.5)

    led1.off()
    led2.on()
    sleep(0.5)