omarbenhamid / micropython-ds1302-rtc

DS1302 RTC Clock driver for Micropython
MIT License
42 stars 16 forks source link

Question about wiring #3

Open Patriboom opened 2 years ago

Patriboom commented 2 years ago

Hello,

thanks for your code.

I try to figure out the wiring, because some pins on my pico are already connected. In your code we read: ds = ds1302.DS1302(Pin(5),Pin(18),Pin(19))

Which are pins 5, 18 et 19 ? 5 is GP2 / SPI0-SCK OR GP3/SPI0-Tx OR GP5 ? 18 is gnd OR I2C SDA/SPI-SCK/GP14 OR GP18 ? 19 is I2C SDA/SPI-SCK/GP14 OR I2C SCL/SPI-TX/GP15 OR GP19 ?

I've tried with the following wiring:

Pico ==>>> UTC GND -> GND 3.3V -> VCC I2C0-SDA (pin 1) -> DAT I2C0-SCL (pin 2) -> CLK GP4 (pin 6) -> RST

with no success.

Thanks for you help.

Patriboom commented 2 years ago

Here answer to my question about the connction

image

With the follow code:

from machine import Pin
import ds1302

ds = ds1302.DS1302(Pin(10),Pin(11),Pin(12))

ds.date_time([2022, 2, 8, 3, 14, 23, 1, 0]) # set datetime.

hre = ds.date_time() # returns the current datetime.
print(hre)
print(ds.hour()) # returns hour.
print(ds.second()) # set second to 10.