DFByy2QDlww 发表于 2020-10-11 18:54:06

阿里云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_LIGHTD2

                        ^

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_LIGHTD2

                        ^

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_LIGHTD2

                        ^

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_LIGHTD2

                        ^

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_LIGHTD2

                        ^

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_LIGHTD2

                        ^

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



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


teu 发表于 2020-10-12 21:16:16

可问df技术:2124609059(qq)或者问@DFSH_Faith

DFSH_Faith 发表于 2020-10-13 10:18:23

使用的SmartLight, 用的不是UNO板把? 或者用了OBLOQ?
如果是UNO那么改D2为13.板载灯。
如果是其他板子,需要选择对板子的型号。 然后根据管脚映射来改代码中的管脚定义。
页: [1]
查看完整版本: 阿里云IoT套件 SmartLight编译错误