Arduino custom library error compiling delay ()

I am trying to write an adruino library, but continue to depend on errors requiring header files to be included. I encountered the fact that I could not find the header file. I keep getting the error:

...file.cpp:23: error: 'delay' was not declared in this scope 

Line 23 of my .cpp file:

 delay(10); 

Any help would be greatly appreciated. Thanks.

+8
include header delay arduino
source share
2 answers

If you are using the Arduino software version prior to version 1.0 (with the version number of the form 00XY, for example, 0023), you need to include WProgram.h in your .cpp files.

If you are using 1.0 or higher, enable Arduino.h instead (the header file has been renamed to this version).

+17
source share

change

  #include "WProgram.h" 

to

  #if defined(ARDUINO) && ARDUINO >= 100 #include "Arduino.h" #else #include "WProgram.h" #endif 

in the abusive header file .h.

+6
source share

All Articles