3061浏览
查看: 3061|回复: 3

[已解决] 请问这是怎么回事

[复制链接]










C:\Users\acer\Desktop\sketch_jan02a\sketch_jan02a.ino: In function 'void openLight()':

sketch_jan02a:6: error: 'D2' was not declared in this scope

#define BEDROOD_LIGHT  D2

                        ^

C:\Users\acer\Desktop\sketch_jan02a\sketch_jan02a.ino:30:16: note: in expansion of macro 'BEDROOD_LIGHT'

   digitalWrite(BEDROOD_LIGHT, HIGH);

                ^

C:\Users\acer\Desktop\sketch_jan02a\sketch_jan02a.ino: In function 'void closeLight()':

sketch_jan02a:6: error: 'D2' was not declared in this scope

#define BEDROOD_LIGHT  D2

                        ^

C:\Users\acer\Desktop\sketch_jan02a\sketch_jan02a.ino:34:16: note: in expansion of macro 'BEDROOD_LIGHT'

   digitalWrite(BEDROOD_LIGHT, LOW);

                ^

C:\Users\acer\Desktop\sketch_jan02a\sketch_jan02a.ino: In function 'void connectWiFi()':

C:\Users\acer\Desktop\sketch_jan02a\sketch_jan02a.ino:40:37: warning: invalid conversion from 'const char*' to 'char*' [-fpermissive]

   WiFi.begin(WIFI_SSID,WIFI_PASSWORD);

                                     ^

In file included from C:\Users\acer\Desktop\sketch_jan02a\sketch_jan02a.ino:1:0:

C:\Users\acer\Desktop\Arduino-1.8.3\libraries\WiFi\src/WiFi.h:79:9: note: initializing argument 1 of 'int WiFiClass::begin(char*, const char*)'

     int begin(char* ssid, const char *passphrase);

         ^

C:\Users\acer\Desktop\sketch_jan02a\sketch_jan02a.ino: In function 'void callback(char*, byte*, unsigned int)':

sketch_jan02a:74: error: 'client' was not declared in this scope

   client.publish(pubTopic,sendMseg);

   ^

C:\Users\acer\Desktop\sketch_jan02a\sketch_jan02a.ino: In function 'void ConnectAliyun()':

sketch_jan02a:78: error: 'client' was not declared in this scope

   while(!client.connected()){

          ^

sketch_jan02a:81: error: 'myAliyun' was not declared in this scope

     if(client.connect(myAliyun.client_id,myAliyun.username,myAliyun.password)){

                       ^

C:\Users\acer\Desktop\sketch_jan02a\sketch_jan02a.ino: In function 'void setup()':

sketch_jan02a:6: error: 'D2' was not declared in this scope

#define BEDROOD_LIGHT  D2

                        ^

C:\Users\acer\Desktop\sketch_jan02a\sketch_jan02a.ino:94:11: note: in expansion of macro 'BEDROOD_LIGHT'

   pinMode(BEDROOD_LIGHT,OUTPUT);

           ^

sketch_jan02a:100: error: 'myAliyun' was not declared in this scope

   myAliyun.init(ALIYUN_SERVER,ProductKey,ClientId,DeviceName,DeviceSecret);

   ^

sketch_jan02a:102: error: 'client' was not declared in this scope

   client.setServer(myAliyun.mqtt_server,PORT);

   ^

C:\Users\acer\Desktop\sketch_jan02a\sketch_jan02a.ino: In function 'void loop()':

sketch_jan02a:118: error: 'client' was not declared in this scope

   if(!client.connected()){

       ^

sketch_jan02a:121: error: 'client' was not declared in this scope

   client.loop();

   ^

exit status 1
'D2' was not declared in this scope


gada888  版主

发表于 2020-1-19 08:48:08

代码开头没有添加库文件
回复

使用道具 举报

kylinpoet  初级技神

发表于 2020-2-18 14:29:21

这个好,必须支持。
回复

使用道具 举报

20060606  高级技匠

发表于 2020-8-5 05:32:40

没有添加库
回复

使用道具 举报

高级模式
B Color Image Link Quote Code Smilies |上传

本版积分规则

为本项目制作心愿单
购买心愿单
心愿单 编辑
[[wsData.name]]

硬件清单

  • [[d.name]]
btnicon
我也要做!
点击进入购买页面
关于楼主

楼主的其它帖子

上海智位机器人股份有限公司 沪ICP备09038501号-4

© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed

mail