http://www.pjrc.com/teensy/td_libs_DS1307RTC.html
下载相关的库程序

 

连接:
DS1306:
1.接3.3V
2.SDA接A4
3.SCL接A5

读取:
#include <Wire.h>
#include <Time.h>
#include <DS1307RTC.h>

在setup里执行读取
setSyncProvider(RTC.get);

 

写入时间办法:
通过例程TimeRTCSet直接在串口发送"Tunix_timestamp"修改时间
注意:在那里输出的unixtimestamp,有些有时区的可能会有时差,因此应该加上相应的时差.

 

 

相关文章:

  • 2021-07-31
  • 2021-11-16
  • 2021-07-12
  • 2021-08-11
  • 2021-09-27
  • 2021-10-25
  • 2021-03-30
  • 2021-03-27
猜你喜欢
  • 2022-01-09
  • 2021-06-08
  • 2021-04-29
  • 2021-10-18
  • 2022-12-23
相关资源
相似解决方案