Board Define

From chipKIT
Jump to: navigation, search

The "Board Define" is a preprocessor macro which identifies to your code which board you are compiling for.

This is provided in the "boards.txt" or "board.txt" file for Arduino and UECIDE respectively and is appended to the compilation command as a "-D" switch.

Using these you can optionally compile different parts of your code - great for selecting different pins on different boards without having to change settings every time you want to compile for a different board.

#if defined(_BOARD_UNO_)
// Code specific to the UNO32 goes here
#elif defined(_BOARD_LENNY_)
// Code specific to the Lenny goes here
#endif