Pie*_*ney 12 header arduino delay include
我正在尝试编写一个adruino库,但一直挂在需要我包含头文件的错误上.我碰到了一个我找不到头文件的.我一直收到错误:
...file.cpp:23: error: 'delay' was not declared in this scope
Run Code Online (Sandbox Code Playgroud)
我的.cpp文件的第23行是:
delay(10);
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激.谢谢.
hel*_*922 19
如果您使用的是1.0之前的Arduino软件版本(版本号为00XY,例如0023),则需要包含WProgram.h在.cpp文件中.
如果您使用的是1.0或更高Arduino.h版本(在该版本中重命名了头文件).
更改
#include "WProgram.h"
Run Code Online (Sandbox Code Playgroud)
至
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
Run Code Online (Sandbox Code Playgroud)
在违规的.h头文件中