I am writing some code and want to include some error checking functions (check to see if some values are out of the usable range, etc).
Checking for errors is easy. However, is there a way to intentionally cause the compile to fail, or prevent the sketch from being downloaded if an error has been found? Is there a way to print a message in the black area in the Arduino IDE?
Prototype a function for each message using the error attribute...
void TinyDebugSerialBadBaud( void ) __attribute__((error("Serial (TinyDebugSerial) supports three baud rates: 9600, 38400, or 115200.")));
void TinyDebugSerialBaudMustBeConstant( void ) __attribute__((error("The baud rate for Serial (TinyDebugSerial) cannot be changed at run-time. Use 9600, 38400, or 115200.")));
Call the function under the conditions that should cause the compiler to halt...