I am trying to connect a MicroPython Lite board to a ds3231 rtc module.
So far I have performed the following steps:
wire connections from the pyboard lite.
x9 -> scl on the module
x10 -> sda on the module
vcc -> vcc on the module
ground -> ground on the module.
Here is my python code:
Code: Select all
import machine
import ssd1306
from utime import sleep
import utime
from machine import RTC
rtc = RTC()
rtc.datetime((2005, 7, 23, 1, 12, 48, 0, 0)) # set a specific date and time
print(rtc.datetime()) # get date and time
oled = ssd1306.SSD1306_I2C(128,64, machine.I2C(1))
while True:
oled.fill(0)
dta = rtc.datetime()
oled.text( str(dta), 0, 20)
oled.text( str(dta[2]) + ':' + str(dta[3]) + ':' + str(dta[4]) + ':' + str(dta[5]) \
+ ':' + str(dta[6])
, 0, 30)
oled.show()
sleep(5)
Please advise.
Kevin Wright