from machine import Pin
from time import ticks_ms
led = Pin(25, Pin.OUT)
led_state = 0
previous_time = ticks_ms()
while True:
current_time = ticks_ms()
if current_time - previous_time >= 1000:
if led_state == 0:
led.value(1)
led_state = 1
else:
led.value(0)
led_state = 0
previous_time = current_time