1523| 2
|
阿里云IoT套件 SmartLight编译错误 |
请问编译错误,啥原因? Arduino:1.8.13 (Windows 10), 开发板:"Arduino Uno" \arduino_modified_sketch_327840\SmartLight.ino: In function 'void openLight()': SmartLight:6:24: error: 'D2' was not declared in this scope #define BEDROOD_LIGHT D2 ^ C:\Users\362663\AppData\Local\Temp\arduino_modified_sketch_327840\SmartLight.ino:34:16: note: in expansion of macro 'BEDROOD_LIGHT' digitalWrite(BEDROOD_LIGHT, HIGH); ^~~~~~~~~~~~~ C:\Users\362663\AppData\Local\Temp\arduino_modified_sketch_327840\SmartLight.ino:6:24: note: suggested alternative: 'A2' #define BEDROOD_LIGHT D2 ^ C:\Users\362663\AppData\Local\Temp\arduino_modified_sketch_327840\SmartLight.ino:34:16: note: in expansion of macro 'BEDROOD_LIGHT' digitalWrite(BEDROOD_LIGHT, HIGH); ^~~~~~~~~~~~~ C:\Users\362663\AppData\Local\Temp\arduino_modified_sketch_327840\SmartLight.ino: In function 'void closeLight()': SmartLight:6:24: error: 'D2' was not declared in this scope #define BEDROOD_LIGHT D2 ^ C:\Users\362663\AppData\Local\Temp\arduino_modified_sketch_327840\SmartLight.ino:38:16: note: in expansion of macro 'BEDROOD_LIGHT' digitalWrite(BEDROOD_LIGHT, LOW); ^~~~~~~~~~~~~ C:\Users\362663\AppData\Local\Temp\arduino_modified_sketch_327840\SmartLight.ino:6:24: note: suggested alternative: 'A2' #define BEDROOD_LIGHT D2 ^ C:\Users\362663\AppData\Local\Temp\arduino_modified_sketch_327840\SmartLight.ino:38:16: note: in expansion of macro 'BEDROOD_LIGHT' digitalWrite(BEDROOD_LIGHT, LOW); ^~~~~~~~~~~~~ C:\Users\362663\AppData\Local\Temp\arduino_modified_sketch_327840\SmartLight.ino: In function 'void setup()': SmartLight:6:24: error: 'D2' was not declared in this scope #define BEDROOD_LIGHT D2 ^ C:\Users\362663\AppData\Local\Temp\arduino_modified_sketch_327840\SmartLight.ino:98:11: note: in expansion of macro 'BEDROOD_LIGHT' pinMode(BEDROOD_LIGHT,OUTPUT); ^~~~~~~~~~~~~ C:\Users\362663\AppData\Local\Temp\arduino_modified_sketch_327840\SmartLight.ino:6:24: note: suggested alternative: 'A2' #define BEDROOD_LIGHT D2 ^ C:\Users\362663\AppData\Local\Temp\arduino_modified_sketch_327840\SmartLight.ino:98:11: note: in expansion of macro 'BEDROOD_LIGHT' pinMode(BEDROOD_LIGHT,OUTPUT); ^~~~~~~~~~~~~ exit status 1 'D2' was not declared in this scope 在文件 -> 首选项开启 “编译过程中显示详细输出”选项 这份报告会包含更多信息。 |
使用的SmartLight, 用的不是UNO板把? 或者用了OBLOQ? 如果是UNO那么改D2为13. 板载灯。 如果是其他板子,需要选择对板子的型号。 然后根据管脚映射来改代码中的管脚定义。 |
© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed