2796 views|2 replies

63

Posts

0

Resources
The OP
 

[Micropython Tutorial] Experiment 1 RTC Usage [Copy link]

 This post was last edited by zhangyadong300 on 2018-6-26 11:05 Conventional IO operations and key reading are relatively simple, and there are many detailed routines posted by forum friends, so I will not repeat them. Let's talk about the operation of RTC, which is also mastered by learning the tutorial post of the moderator. 【Micropython】Using RTChttps://en.eeworld.com/bbs/thread-485837-1-1.html Let's get to the point: Step 1: Solder the power-off capacitor. According to the moderator's post, the specification is 0.22f, and the power-off clock retention time is 2-3 days. Step 2: Write code. I have to say that uPyCraft, a tool developed by DFRobot, is really easy to use. Download address:
链接已隐藏,如需查看请登录或者注册
  1. import pyb from pyb import RTC from pyb import Switch import time rtc = RTC() print(rtc.info()) # Define buttons switch=pyb.Switch() # Set time (first time setting) # rtc.datetime((2018, 6, 25, 1, 18, 26, 0, 0)) # Print time print(rtc.datetime()) def printtime(): dt = pyb.RTC().datetime() print("Current time: %d year %d month %d day - %d: %d: %d" %(dt[0], dt[1], dt[2], dt[4], dt[5], dt[6],)) while True: # Detect button press if(switch()): # Detect button release while switch(): pass printtime()
复制代码
Output display:

Latest reply

The title should be RTC   Details Published on 2018-6-26 10:53
 
 

1w

Posts

25

Resources
2
 
The title should be RTC

Comments

Haha, my hands are shaking, so I need to change it.  Details Published on 2018-6-26 11:06
 
 
 

63

Posts

0

Resources
3
 
dcexpert posted on 2018-6-26 10:53 The title should be RTC
Haha, my hands are shaking, so I changed it
 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list