Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) ArduinoAssertExample1

 

Technical facts

 

Operating system(s) or programming environment(s)

IDE(s):

Project type:

C++ standard:

Compiler(s):

Libraries used:

 

 

 

 

 

Qt project file: ./ArduinoAssertExample1/ArduinoAssertExample1.pro

 

TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt

HEADERS += arduinoassert.h

OTHER_FILES += \
    ArduinoAssertExample1.ino

 

 

 

 

 

./ArduinoAssertExample1/arduinoassert.h

 

#ifndef ARDUINOASSERT_H
#define ARDUINOASSERT_H

//Version 1.0

//From http://www.richelbilderbeek.nl/CppAssert.htm
#ifdef NDEBUG
  #define Assert(x) ((void)0)
#else
  #include <Arduino.h>
  //#include <Serial.h>
  #define Assert(x)                     \
  if (!(x))                             \
  {                                     \
    Serial.print("ERROR!!\n");          \
    Serial.print("Assertion failed\n"); \
    Serial.print(#x);                   \
    delay(10000);                       \
    exit(1);                            \
  }
#endif

#endif // ARDUINOASSERT_H

//Version history:
// - 2013-01-17: version 1.0: initial version

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict

This page has been created by the tool CodeToHtml