In this article we will see Different methods and class for RTC (Real Time Clock). we know that in current scenario developer mostly prefer micropython programming concept to built or innovation of any idea. so in this section we refer some basics concept of RTC.
Table of Contents
Basic Class of RTC
def settime():
t = time()
import machine
import utime
rtc_SACH = machine.RTC()
rtc_SACH.datetime((2021, 9, 11, 2, 11, 32, 36, 0))
print(rtc.datetime())
Explanation: This code basically show the syntax for RTC. Remember that we need to import machine and utime module, without this module it’s not possible to access RTC Functionality.
Different kinds of Methods for RTC
- RTC.init(datetime/dataformat)
- RTC.datetime()
- RTC.now()
- RTC.deinit()
- RTC.alarm()
- RTC.alarm_left()
- RTC.cancel(alarm_id=0)
This method help you to initialise the RTC.
Format of datetime:
(year, month, day[, hour[, minute[, second]]]])
Summary:
In this article we saw Basic class and functions in RTC so about this section you have any query then free to ask me