Conditional library inclusion

A #include tells the compiler to put the text of that file right there. That is before the compiler starts compiling. Anything you do before the #include can be used.

Another thing at text level (before compiling) is the #ifdef directives : Conditional inclusion - cppreference.com

There are two ways:

  1. Make a define or not. You can test if the define exists with #ifdef MYSERIALPORT
  2. Give a define a number. Test what number the define has #if MYSERIALPORT == 1