78678967 发表于 2019-6-12 20:59:09

cityant 发表于 2019-5-18 20:12
把之前的代码调整了一下,加入了smartconfig配置WiFi;
操作方法:
1、如果启动无法连接wifi,会自动进入sm ...

Arduino:1.8.4 (Windows 7), 开发板:"NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Disabled, 4M (no SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

构建选项已变更,全部重新构建
C:\Users\Administrator\Desktop\NTPclock\NTPclock.ino: In function 'void init_rtc()':

NTPclock:383: error: 'class RtcDS3231<TwoWire>' has no member named 'LastError'

if (!Rtc.GetIsRunning() || Rtc.LastError() !=0 ) {

                                 ^

exit status 1
'class RtcDS3231<TwoWire>' has no member named 'LastError'

在文件 -> 首选项开启
“编译过程中显示详细输出”选项
这份报告会包含更多信息。
这是怎么回事呢

chinadreamc 发表于 2019-6-13 18:03:15

LedControl.h 这个头文件在哪能下载?

cityant 发表于 2019-6-14 13:57:01

78678967 发表于 2019-6-12 12:49
大神你好能增加直接连接温度和湿度传感器吗

可以加个dht11/21吧,多了湿度需要改一下显示

cityant 发表于 2019-6-14 13:58:16

78678967 发表于 2019-6-12 20:59
Arduino:1.8.4 (Windows 7), 开发板:"NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Disabled, 4M (no...

你使用的是我上传的ds3231的库吗?用我这个库编译试试

cityant 发表于 2019-6-14 14:01:28

chinadreamc 发表于 2019-6-13 18:03
LedControl.h 这个头文件在哪能下载?

LedControl库

78678967 发表于 2019-6-14 20:31:30

cityant 发表于 2019-6-14 13:58
你使用的是我上传的ds3231的库吗?用我这个库编译试试

我使用的是你第二次分享的那个库

78678967 发表于 2019-6-14 22:14:49

cityant 发表于 2019-6-14 13:58
你使用的是我上传的ds3231的库吗?用我这个库编译试试

temp = Temperature.AsFloatDegC();和if (!Rtc.GetIsRunning() || Rtc.LastError() !=0 ) {
都显示跟这个差不多的错误提示
exit status 1
'class RtcTemperature' has no member named 'AsFloatDegC'

78678967 发表于 2019-6-15 08:17:16

cityant 发表于 2019-6-14 13:57
可以加个dht11/21吧,多了湿度需要改一下显示

接dht12无法显示温度

cityant 发表于 2019-6-15 10:52:13

78678967 发表于 2019-6-14 22:14
temp = Temperature.AsFloatDegC();和if (!Rtc.GetIsRunning() || Rtc.LastError() !=0 ) {
都显示跟这个 ...

下面代码中有一个注释行,是我用之前的库提供的用法。你注释掉下面这行,启用前一行编译看看,如果不报错那肯定是ds3231的库用的版本不对。


void Load_temp(void){   //温度组合与显示

float temp = 0;
if (rtcstatus){
    RtcTemperature Temperature = Rtc.GetTemperature();    //读取DS3231中的温度数据
    //temp = Temperature.AsFloat();      //去掉此行注释试试
    temp = Temperature.AsFloatDegC();    //此行报错,先注释掉
}
else{   //RTC不可用时,使用一个错误值代替;
    temp = 99.0;
}

你把当前ide环境中的ds3231库都去掉,然后加载我这个库

78678967 发表于 2019-6-15 20:43:23

cityant 发表于 2019-6-15 10:52
下面代码中有一个注释行,是我用之前的库提供的用法。你注释掉下面这行,启用前一行编译看看,如果不报错 ...

去掉蓝色的代码报错Arduino:1.8.4 (Windows 7), 开发板:"NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Disabled, 4M (no SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

C:\Users\Administrator\Desktop\NTPclock\NTPclock.ino: In function 'void Load_temp()':

NTPclock:263: error: 'class RtcTemperature' has no member named 'AsFloatDegC'

temp = Temperature.AsFloatDegC();//姝よ鎶ラ敊锛屽厛娉ㄩ噴鎺?

                     ^

C:\Users\Administrator\Desktop\NTPclock\NTPclock.ino: In function 'void init_rtc()':

NTPclock:383: error: 'class RtcDS3231<TwoWire>' has no member named 'LastError'

if (!Rtc.GetIsRunning() || Rtc.LastError() !=0 ) {

                                 ^

exit status 1
'class RtcTemperature' has no member named 'AsFloatDegC'

在文件 -> 首选项开启
“编译过程中显示详细输出”选项
这份报告会包含更多信息。
如何解决?
好像是你的库里没有这个'AsFloatDegC'
希望楼主讲详细一点我是编程菜鸟

78678967 发表于 2019-6-15 21:44:45

cityant 发表于 2019-6-15 10:52
下面代码中有一个注释行,是我用之前的库提供的用法。你注释掉下面这行,启用前一行编译看看,如果不报错 ...

去掉temp = Temperature.AsFloatDegC();和 || Rtc.LastError() !=0就能编译但是WiFi显示不出来,按FLASH也没用

cityant 发表于 2019-6-16 10:12:33

78678967 发表于 2019-6-15 21:44
去掉temp = Temperature.AsFloatDegC();和 || Rtc.LastError() !=0就能编译但是WiFi显示不出来,按FLASH ...

我感觉还是库的问题,你可以搜索一下arduino文件下还有没有其它的“RtcDS3231.h”这个头文件。删除其它的,只保留我上传的那个。

另外你也可以尝试把RtcDS3231库放在主程序目录下,然后直接引用当前头文件;
#include “RtcDS3231.h”

cityant 发表于 2019-6-16 10:22:29

78678967 发表于 2019-6-15 21:44
去掉temp = Temperature.AsFloatDegC();和 || Rtc.LastError() !=0就能编译但是WiFi显示不出来,按FLASH ...

给你个编译好的固件,可以直接写进去用。后续慢慢查编译问题。

78678967 发表于 2019-6-17 22:05:56

cityant 发表于 2019-6-16 10:22
给你个编译好的固件,可以直接写进去用。后续慢慢查编译问题。

希望大神能加上dht12传感器

cityant 发表于 2019-6-19 16:03:26

78678967 发表于 2019-6-17 22:05
希望大神能加上dht12传感器

这个到倒可以考虑,抽点时间改一下代码。
页: 1 2 3 [4] 5 6 7 8 9 10 11 12 13
查看完整版本: 基于ESP8266自动校时时钟