TiLDA MK3/rtc: Difference between revisions

From EMF Badge
Jump to navigation Jump to search
(Created page with "The following code snippets demonstrate the RTC. See the micropython docs [https://micropython.org/doc/module/pyb/RTC] for more information. <pre> # Create a RTC object rtc =...")
 
(fix broken link to micropython rtc docs)
 
Line 1: Line 1:
The following code snippets demonstrate the RTC. See the micropython docs [https://micropython.org/doc/module/pyb/RTC] for more information.
The following code snippets demonstrate the RTC. See the micropython docs [https://docs.micropython.org/en/latest/pyboard/library/pyb.RTC.html] for more information.


<pre>
<pre>

Latest revision as of 00:52, 2 March 2017

The following code snippets demonstrate the RTC. See the micropython docs [1] for more information.

# Create a RTC object
rtc = pyb.RTC()

# If the RTC isn't running, call
rtc.init()

# Set the time 
rtc.datetime((2016, 5, 1, 4, 13, 0, 0, 0))

# Get the time
print(rtc.datetime())