Arduino custom library error when compiling delay()

Pierce Barney picture Pierce Barney · Dec 21, 2011 · Viewed 18.1k times · Source

I am trying to write an adruino library but keep getting hung up on errors requiring me to include header files. I have run into one that I can't find the header file for. I keep getting the error:

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

Line 23 of my .cpp file is:

delay(10);

Any help would be greatly appreciated. Thank you.

Answer

helloworld922 picture helloworld922 · Dec 21, 2011

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

If you are using 1.0 or above include Arduino.h instead (the header file was renamed in that version).