import tm1637
import time
from machine import Pin,PWM
# 四位數顯示器
tm = tm1637.TM1637(clk=Pin(22), dio=Pin(23))
#喇叭
buzzer = PWM(Pin(27),duty=0)
def ambulance():
for i in range(1,10):
buzzer.freq(800)
buzzer.duty(100)
buzzer.freq(400)
time.sleep(0.5)
buzzer.freq(800)
time.sleep(0.5)
buzzer.duty(0)
for x in range(9999,-1,-1):
a = x //100
b = x % 100
tm.numbers(a,b)
time.sleep(0.1)
if b == 0:
ambulance()