from machine import Pin, SPI, I2C
from utime import sleep
from max7219 import Matrix8x8
import max7219
from tm1637 import TM1637
from ds1307 import DS1307
import time


i2c = I2C(0, scl=Pin(9), sda=Pin(8))
rtc = DS1307(i2c)
tm = TM1637(clk=Pin(6), dio=Pin(7))
spi = SPI(0, baudrate=10000000, polarity=1, phase=0, sck=Pin(2), mosi=Pin(3))
ss = Pin(5, Pin.OUT)
display = max7219.Matrix8x8(spi, ss, 1)
display.brightness(15)


buzzer = Pin(18, Pin.OUT)

def beep():
    buzzer.value(1)
    sleep(0.2)
    buzzer.value(0)


def display_hello_world():
    message = "HELLO WORLD"
    display.fill(0)
    for i, char in enumerate(message):
        display.text(char, 0, i * 8)
        display.show()
        sleep(1)


def display_time():
    now = rtc.datetime 
    print("RTC:", now) 
    hours = now[4] 
    minutes = now[5] 
    tm.numbers(hours, minutes)


def main():
    last_minute = -1
    display_hello_world() 

    while True:
        current_time = rtc.datetime
        minutes = current_time[5] 
        display_time()
        

        if minutes != last_minute:
            beep()
            last_minute = minutes
        
        sleep(1)

main()
BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT
pico:GP0
pico:GP1
pico:GND.1
pico:GP2
pico:GP3
pico:GP4
pico:GP5
pico:GND.2
pico:GP6
pico:GP7
pico:GP8
pico:GP9
pico:GND.3
pico:GP10
pico:GP11
pico:GP12
pico:GP13
pico:GND.4
pico:GP14
pico:GP15
pico:GP16
pico:GP17
pico:GND.5
pico:GP18
pico:GP19
pico:GP20
pico:GP21
pico:GND.6
pico:GP22
pico:RUN
pico:GP26
pico:GP27
pico:GND.7
pico:GP28
pico:ADC_VREF
pico:3V3
pico:3V3_EN
pico:GND.8
pico:VSYS
pico:VBUS
matrix1:V+
matrix1:GND
matrix1:DIN
matrix1:CS
matrix1:CLK
matrix1:V+.2
matrix1:GND.2
matrix1:DOUT
matrix1:CS.2
matrix1:CLK.2
4-Digit Display
sevseg1:CLK
sevseg1:DIO
sevseg1:VCC
sevseg1:GND
GND5VSDASCLSQWRTCDS1307+
rtc1:GND
rtc1:5V
rtc1:SDA
rtc1:SCL
rtc1:SQW
bz1:1
bz1:2