from machine import Pin
from utime import sleep
led = Pin(5, Pin.OUT)
switch = Pin(6, Pin.IN, Pin.PULL_UP)
while True:
while switch.value():
pass
for minute in range(3, 0, -1):
for _ in range(minute * 5 * 2):
led.high()
sleep(0.5)
led.low()
sleep(0.5)
if minute > 0:
sleep(60 - (minute * 5 * 2) * 1.0)
while not switch.value():
pass