I have an RTC DS1302 and wish to connect to the RP Pico using Micropython. The “Raspberry Pi Pico with MicroPython” mentions only DS1307.
Hi.
The library we use in the eBook is not compatible with the RTC DS1302.
I found this library that is compatible with your module: https://github.com/omarbenhamid/micropython-ds1302-rtc/tree/master
They have a basic example to show how to use the methods:
from machine import Pin
import ds1302
ds = ds1302.DS1302(Pin(5),Pin(18),Pin(19))
ds.date_time() # returns the current datetime.
ds.date_time([2018, 3, 9, 4, 23, 0, 1, 0]) # set datetime.
ds.hour() # returns hour.
ds.second(10) # set second to 10.
Let me know if you can adapt our examples to use that library. Otherwise, I can try to help (however, I don’t have that specific module to test).
Regards,
Sara