How do I get byte, HIGH, LOW etc. definitions ?

I’m trying to put classes supporting sound-making in a separate cpp file with its own header file. Unfortunately, that separate file isn’t provided supporting data types like ‘byte’, HIGH, LOW … and probably others. It looks to me like the definitions are in wiring.h , but including <wiring.h> in my files resulted in all sorts of compiler errors. The same for just putting those definitions in my header by hand. I’m assuming that things are being declared in the wrong order.

So what do I put in my supporting files that will allow them to get all the variables and definitions that my main file sees?


I am not sure there is an elegant way to solve this but a common solution is to use the base types in your header file - for example declare byte or boolean arguments as uint8_t

Note that HIGH and LOW are not types, they are #defines.

Well right off I have a problem, since the compiler can't find the definition of uint8_t. Where is it defined?

Thanks! Mark

Ok, the magic incantation appears to be:

include "WProgram.h"

thanks! Mark

you can also get it from
#include <inttypes.h>
if wProgram causes you any problems

You could just click on the "new tab" file and add your separate code there. it'll actually generate a separate .pde file, but will carry with it all the necessary defines, includes, etc.

if that sound support could be useful as a library then having a separate header would be necessary.