From 8728684d67bc4dbad3b0b64e3f4b0ef82264d1b6 Mon Sep 17 00:00:00 2001 From: spdis Date: Fri, 30 May 2025 18:36:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20Dorm-Air-Conditioner-Smart?= =?UTF-8?q?-Controller.ino?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dorm-Air-Conditioner-Smart-Controller.ino | 35 +++++++---------------- 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/Dorm-Air-Conditioner-Smart-Controller.ino b/Dorm-Air-Conditioner-Smart-Controller.ino index 3d5da4f..4c4b46a 100644 --- a/Dorm-Air-Conditioner-Smart-Controller.ino +++ b/Dorm-Air-Conditioner-Smart-Controller.ino @@ -1,36 +1,23 @@ #include "DHT11control.h" +#include "RTC_Module.h" +#include + +ThreeWire myWire(4,5,2); +RtcDS1302 Rtc(myWire); + void setup() { // 初始化串口通信 Serial.begin(115200); + // 启动DHT传感器 dht.begin(); + // 启动ds1302 + setupRTC(); + } void loop() { - //接下来都只是为了让串口监视器能输出温度和湿度,判断dht11是否正常工作,后续会删除 - - - // 获取温湿度数据指针 - float* results = getTempAndHumidity(); - - // 数据有效性校验 - if(results[0] != -999 && results[1] != -999) { - // 格式化输出温度数据 - Serial.print("Temperature: "); - Serial.print(results[0]); - Serial.print(" °C, "); - - // 格式化输出湿度数据 - Serial.print("Humidity: "); - Serial.print(results[1]); - Serial.println(" %"); - } - - // 维持2秒采样间隔 - delay(2000); - - - //到此为止 +//暂时留空备用,函数调用方法已转移至文档 } \ No newline at end of file