wifiduino程序上传出错
希望大佬帮忙看下~完整代码(就是根据Blinker技术文档里的实例略加修改)如下
#define BLINKER_PRINT Serial
#define BLINKER_WIFI
#include <Blinker.h>
char auth[] = "625cfae33206";
char ssid[] = "CuMoon";
char pswd[] = "147532515117";
//设置电机控制引脚
int DIR1 = 4; //棕
int PWM1 = 5; //红
int PWM2 = 6; //橙
int DIR2 = 7; //黄
// 新建组件对象
BlinkerButton Button1("btn-abc");
BlinkerNumber Number1("num-abc");
int counter = 0;
// 按下按键即会执行该函数
void button1_callback(const String & state) {
BLINKER_LOG("get button state: ", state);
digitalWrite(DIR1,LOW);
digitalWrite(DIR2,LOW);
analogWrite(PWM1,255);
analogWrite(PWM2,255);
}
void setup() {
// 初始化串口
Serial.begin(115200);
#if defined(BLINKER_PRINT)
BLINKER_DEBUG.stream(BLINKER_PRINT);
#endif
// 初始化有LED的IO
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, HIGH);
// 初始化blinker
Blinker.begin(auth, ssid, pswd);
Blinker.attachData(dataRead);
Button1.attach(button1_callback);
//
pinMode(DIR1,OUTPUT);
pinMode(PWM1,OUTPUT);
pinMode(PWM2,OUTPUT);
pinMode(DIR2,OUTPUT);
}
void loop() {
Blinker.run();
}
////////////////////////////
错误信息如下
Arduino:1.8.7 (Windows 10), 开发板:"WiFiduino, 80 MHz, Flash, Disabled, All SSL ciphers (most compatible), 4M (no SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 921600"
In file included from C:\Users\齐\Documents\Arduino\libraries\blinker-library-master\src/BlinkerESPMQTT.h:10:0,
from C:\Users\齐\Documents\Arduino\libraries\blinker-library-master\src/Blinker.h:36,
from C:\Users\璇歌憶淇綈\Desktop\Hello_WiFi\Hello_WiFi.ino:6:
C:\Users\齐\Documents\Arduino\libraries\blinker-library-master\src/Adapters/BlinkerMQTT.h: In member function 'virtual char* BlinkerMQTT::lastRead()':
C:\Users\齐\Documents\Arduino\libraries\blinker-library-master\src/Adapters/BlinkerMQTT.h:684:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
else return "";
^
In file included from C:\Users\齐\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:82:0,
from C:\Users\齐\Documents\Arduino\libraries\blinker-library-master\src/BlinkerESPMQTT.h:11,
from C:\Users\齐\Documents\Arduino\libraries\blinker-library-master\src/Blinker.h:36,
from C:\Users\璇歌憶淇綈\Desktop\Hello_WiFi\Hello_WiFi.ino:6:
C:\Users\齐\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApiBase.h: In member function 'char* BlinkerBridge_key::getName()':
C:\Users\齐\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApiBase.h:194:29: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
else return "false";
^
In file included from C:\Users\齐\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:83:0,
from C:\Users\齐\Documents\Arduino\libraries\blinker-library-master\src/BlinkerESPMQTT.h:11,
from C:\Users\齐\Documents\Arduino\libraries\blinker-library-master\src/Blinker.h:36,
from C:\Users\璇歌憶淇綈\Desktop\Hello_WiFi\Hello_WiFi.ino:6:
C:\Users\齐\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerProtocol.h: In member function 'char* BlinkerProtocol::deviceName()':
C:\Users\齐\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerProtocol.h:96:86: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
char * deviceName() { if (isInit) return conn->deviceName(); else return ""; }
^
C:\Users\齐\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerProtocol.h: In member function 'char* BlinkerProtocol::authKey()':
C:\Users\齐\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerProtocol.h:97:83: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
char * authKey() { if (isInit) return conn->authKey(); else return "";}
^
C:\Users\齐\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerProtocol.h: In member function 'char* BlinkerProtocol::dataParse()':
C:\Users\齐\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerProtocol.h:226:86: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
char* dataParse() { if (canParse) return conn->lastRead(); else return ""; }
^
In file included from C:\Users\齐\Documents\Arduino\libraries\blinker-library-master\src/BlinkerESPMQTT.h:11:0,
from C:\Users\齐\Documents\Arduino\libraries\blinker-library-master\src/Blinker.h:36,
from C:\Users\璇歌憶淇綈\Desktop\Hello_WiFi\Hello_WiFi.ino:6:
C:\Users\齐\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: At global scope:
C:\Users\齐\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:762:97: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
BlinkerWidgets_string _BUILTIN_SWITCH = BlinkerWidgets_string(BLINKER_CMD_BUILTIN_SWITCH);
^
C:\Users\齐\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'char* BlinkerApi::bridgeKey(uint8_t)':
C:\Users\齐\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:6258:21: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
else return "";
^
C:\Users\齐\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'char* BlinkerApi::bridgeName(uint8_t)':
C:\Users\齐\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:6265:21: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
else return "false";
^
C:\Users\齐\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'char* BlinkerApi::widgetName_str(uint8_t)':
C:\Users\齐\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:6887:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
else return "";
^
C:\Users\齐\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'char* BlinkerApi::widgetName_rgb(uint8_t)':
C:\Users\齐\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:6901:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
else return "";
^
C:\Users\齐\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'char* BlinkerApi::widgetName_int(uint8_t)':
C:\Users\齐\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:6907:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
else return "";
^
C:\Users\齐\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h: In member function 'char* BlinkerApi::widgetName_tab(uint8_t)':
C:\Users\齐\Documents\Arduino\libraries\blinker-library-master\src/Blinker/BlinkerApi.h:6913:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
else return "";
^
C:\Users\璇歌憶淇綈\Desktop\Hello_WiFi\Hello_WiFi.ino: At global scope:
C:\Users\璇歌憶淇綈\Desktop\Hello_WiFi\Hello_WiFi.ino:20:32: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
C:\Users\璇歌憶淇綈\Desktop\Hello_WiFi\Hello_WiFi.ino:21:32: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
C:\Users\璇歌憶淇綈\Desktop\Hello_WiFi\Hello_WiFi.ino: In function 'void setup()':
Hello_WiFi:48:24: error: 'dataRead' was not declared in this scope
exit status 1
'dataRead' was not declared in this scope
在文件 -> 首选项开启
“编译过程中显示详细输出”选项
这份报告会包含更多信息。
本帖最后由 zjssun 于 2019-7-28 12:54 编辑
dataRead没有声明是什么,你可以去掉或写个dataRead函数 看文档吧 Hello_WiFi:48:24: error: 'dataRead' was not declared in this scope
翻译过来的意思:
你程序中没有定义dataRead
建议按照blinker文档教程学习,理解后,再自由发挥 是4567引脚不能用吗?
abcd2019 发表于 2019-7-28 13:34
是4567引脚不能用吗?
6、7不行
可见:
https://wifiduino.com/
页:
[1]