连接与Esp8266 ThinkSpeak FireBeetle董事会错误

12个视图(30天)
我连接使用Esp8266 ThinkSpeak FireBeetle板上芯片。我使用这段代码:
# include < SoftwareSerial.h >
#定义RX 2
#定义TX 3
字符串美联社= " * * * * * * * * * *”;/ /美联社的名字
字符串传递= " * * * * * * * * *”;/ /美联社密码
字符串API = " * * * * * * * * * * * * *”;/ /写API键
字符串主机= " api.thingspeak.com ";
字符串端口= " 80 ";
字符串字段= " field1”;
int countTrueCommand;
int countTimeCommand;
布尔发现= false;
int valSensor = 1;
SoftwareSerial esp8266 (RX, TX);
无效的设置(){
Serial.begin (9600);
esp8266.begin (115200);
sendCommand(“在”5“OK”);
sendCommand (“+ CWMODE = 1”5“OK”);
sendCommand(“在+ CWJAP = \ " + AP +“\”, \““+ +”\”, 20岁的“OK”);
}
无效循环(){
valSensor = getSensorData ();
字符串getData = " /更新吗?api_key = " + API + " & " + +”= " +字符串(valSensor);
sendCommand (“+ CIPMUX = 1”5“OK”);
sendCommand(“在+ CIPSTART = 0, \“TCP \”, \“+主机+“\”、“+端口,15日“OK”);
sendCommand (+ CIPSEND = 0, +字符串(getData.length () + 4), 4,“>”);
esp8266.println (getData);延迟(1500);countTrueCommand + +;
sendCommand (“+ CIPCLOSE = 0”5“OK”);
}
int getSensorData () {
返回随机(1000);/ /测试
}
空白sendCommand (String命令,int maxTime, char readReplay []) {
并同时countTrueCommand);
并同时”。在命令= > ");
并同时(命令);
系列。打印(" ");
而(countTimeCommand < (maxTime * 1))
{
esp8266.println(命令);/ / + cipsend
如果(esp8266.find (readReplay)) / /好吧
{
发现= true;
打破;
}
countTimeCommand + +;
}
如果发现= = true)
{
以“OYI”);
countTrueCommand + +;
countTimeCommand = 0;
}
如果发现= = false)
{
以“失败”);
countTrueCommand = 0;
countTimeCommand = 0;
}
发现= false;
}
__________________________________________________________________________________________________________________
我得到这个错误呢?在串行监控当我运行它。
输出:
失败
0。在命令= > + CWMODE = 1失败
0。在+ CWJAP =命令= >“* * * * * *”、“* * * * * * * *”失败
0。在命令= > + CIPMUX = 1失败
0。在+ CIPSTART =命令= > 0,“TCP”,“api.thingspeak.com”, 80失败
0。在+ CIPSEND =命令= > 0,51失败
1。在命令= > + CIPCLOSE = 0失败
0。在命令= > + CIPMUX = 1失败
0。在+ CIPSTART =命令= > 0,“TCP”,“api.thingspeak.com”, 80失败
0。在+ CIPSEND =命令= > 0,51失败
1。在命令= > + CIPCLOSE = 0失败
0。在命令= > + CIPMUX = 1失败
0。在+ CIPSTART =命令= > 0,“TCP”,“api.thingspeak.com”, 80失败
0。在+ CIPSEND =命令= > 0,51失败
1。在命令= > + CIPCLOSE = 0失败
0。在命令= > + CIPMUX = 1失败
_________________________________________________________________________________________________________________
我做错了什么?无线网络密码和名称是正确的。我真的找不到任何在线的帮助。我诚实的想法,我一直在试图修复它一整天。

接受的答案

约翰•阿南德
约翰•阿南德 2022年1月9日
我#包括“ThingSpeak所取代。h与Wifi库”,我也改变了一些其他的代码没有错误。还有一件事,我改变了波特率 115200年到9600年。
_____________________________________________________________________________
# include < WiFi.h >
# include < WiFiClient.h >
# include < WiFiServer.h >
# include < WiFiUdp.h >
___________________________________________________________________________________
的例子在github esp8266你必须改变的代码,它给你这个错误(下图)或者“不承认char或int”。
(代码)
# include < ESP8266WiFi.h >
# include“secrets.h”
字符串名称= " # # # # # # # # r”;/ /美联社的名字
字符串传递= " # # # # # # # #”;/ /美联社密码
字符串API = " # # # # # # # # #”;/ /写API键
WiFiClient客户;
_____________________________________________________________________________________
(错误)
测试:1:15:错误:“名字”不是宣布在这个范围
1 |字符名称[]=名称;/ /你的网络名称(名称)
| ^ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
测试:2:15:错误:“密码”并不是宣布在这个范围
2 | char[] =通过密码;/ /你的网络密码
| ^ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
测试:4:1:错误:“WiFiEspClient”不名一个类型
4 | WiFiEspClient客户;
| ^ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
测试:7:1:错误:预计宣言“}”牌
7 |}
| ^
退出状态1
“SECRET_SSID”并不是宣布在这个范围
____________________________________________________________
但是我觉得出来了工作,谢谢你的帮助,祝你好运与您的项目firebeetle板,我爱firebeetle董事会,但他们有很多问题有时也如果你曾经使用esp8266我强烈推荐使用这些。再次感谢,祝你有美好的一天。
http://arduino.esp8266.com/stable/package_esp8266com_index.json
http://download.dfrobot.top/FireBeetle/package_firebeetle8266_index.json

更多的答案(2)

克里斯托弗Stapels
克里斯托弗Stapels 2022年1月9日
为什么不试一试 ThingSpeak图书馆Arduino和ESP和其他人 吗?我认为它容易得多比使用AT命令集。
1评论
约翰•阿南德
约翰•阿南德 2022年1月9日
我并没有同我的代码(与其他部分我做的一个项目)。你认为这是一个好主意使用不同的比esp板?如果是什么板?

登录置评。


约翰•阿南德
约翰•阿南德 2022年1月9日
很抱歉打扰你了。但是我在每一个github的,像你建议我这个错误。
Arduino: 1.8.19 (Windows存储1.8.57.0)(Windows 10),板:“FireBeetle-ESP8266, 80 MHz, 921600 4 m (3 m使整洁)”
警告:图书馆ESP8266WiFi声称esp8266架构上运行(s)和可能不符合你目前的董事会firebeetle8266架构(s)上运行。
警告:图书馆ThingSpeak声称运行在avr, esp8266,山姆,samd, esp32, samd_beta, megaavr架构(s)和可能不符合你目前的董事会负责firebeetle8266架构(s)。
github_second_try_for_esp: 32:17:错误:无效的转换从‘const char *’的char [-fpermissive]
char keyIndex =;/ /你的网络密钥索引号(WEP只需要)
^
多个库被发现“ThingSpeak.h”
使用:C:\Users\john\Documents\Arduino\libraries\ThingSpeak
不习惯:C:\Users\john\Documents\Arduino\libraries\ ThingSpeak-2.0.1
退出状态1
无效的转换从‘const char *’“字符”(-fpermissive)
______________________________________________________________________________________________________
但是我只有一个ThinkSpeak文件在我的电脑。
2的评论
约翰•阿南德
约翰•阿南德 2022年1月9日
我爱制动命令打开找出负责人,我给他们一个+一个如果你想要一个头部疼痛。我基本上与他们智能手机和罗拉(强烈推荐尝试罗拉),但是也有很多很多错误的命令。

登录置评。

社区

更多的答案ThingSpeak社区

类别

找到更多的在行为数据帮助中心文件交换

社区寻宝

找到宝藏在MATLAB中央,发现社区如何帮助你!

开始狩猎!