I own a Raspberry PI 3, and I would like to use the real-time clock (https://www.microchip.com/wwwproducts/e ... l-features), which is connected on the i2c. I started by setting up RTC and I can get the date by typing date on Terminal:
Code: Select all
import pyb import time rtc=pyb.RTC() # create object RTC print (rtc.datetime()) # (year, month, day, weekday, hours, minutes, seconds, subseconds) #rtc.datetime((2017,9,22,4,18,39,4,0)) #print(rtc.datetime()) while True : print (str(rtc.datetime()),':',str(rtc.datetime()),':',str(rtc.datetime()))) # hh:mm:ss pyb.delay(1000)
Do I have to install something for python to recognize 'pyb' or am I on the wrong path? indications (for the use of RTC)?