31 lines
573 B
C++
31 lines
573 B
C++
//使用preferences作为数据持久化方案,类似于本项目的数据库
|
|
#include <Preferences.h>
|
|
|
|
#include "DHT11control.h"
|
|
|
|
#include "RTC_Module.h"
|
|
#include <RtcDS1302.h>
|
|
|
|
ThreeWire myWire(4,5,2);
|
|
RtcDS1302<ThreeWire> Rtc(myWire);
|
|
|
|
void setup() {
|
|
// 初始化串口通信
|
|
Serial.begin(115200);
|
|
|
|
Preferences prefs; // 声明Preferences对象
|
|
|
|
//打开preferences命名空间:DACSC
|
|
prefs.begin("DACSC");
|
|
|
|
// 启动DHT传感器
|
|
dht.begin();
|
|
// 启动ds1302
|
|
setupRTC();
|
|
|
|
}
|
|
|
|
void loop() {
|
|
|
|
//暂时留空备用,函数调用方法已转移至文档
|
|
} |