Rtc - Pycom WiPy 3.0 Manual

Hide thumbs Also See for WiPy 3.0:
Table of Contents

Advertisement

5.2.1.6 RTC

class RTC – Real Time Clock
The RTC is used to keep track of the date and time.
Quick Usage Example
from machine import RTC
rtc = RTC()
rtc.init((2014, 5, 1, 4, 13, 0, 0, 0))
print(rtc.now())
Constructors
class machine.RTC(id=0, ...)
Create an RTC object. See init for parameters of initialisation.
# id of the RTC may be set if multiple are connected. Defaults to id = 0.
rtc = RTC(id=0)
Methods
rtc.init(datetime=None, source=RTC.INTERNAL_RC)
Initialise the RTC. The arguments are:
when passed it sets the current time. It is a tuple of the form:
datetime
day[, hour[, minute[, second[, microsecond[, tzinfo]]]]])
selects the oscillator that drives the RTC. The options are RTC.INTERNAL_RC
source
and RTC.XTAL_32KHZ
For example:
# for 2nd of February 2017 at 10:30am (TZ 0)
rtc.init((2017, 2, 28, 10, 30, 0, 0, 0))
is ignored by this method. Use
tzinfo
to achieve similar results.
time.timezone
(year, month,
.
268

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the WiPy 3.0 and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

SipyGpyLopyLopy4Fipy

Table of Contents