Debugging - CrcLib Error Codes

What is it?

CrcLib is equipped with a functionality that helps troubleshooting common programming mistakes that cannot be recognize by the compiler before loading the code into the micro-controller.

As your program is executed by the CrcDuino, CrcLib actively monitors the code execution and falls into Error mode if a CrcLib component is incorrectly used.

CrcLib error codes are not to be mixed up with the Arduino IDE compiling error message buffer. The bottom message window in Arduino IDE tells you what caused a compiling error, when it tried to translate your code into executable instructions for the micro-controller. A compiling error indicates that something is wrong in how you syntactically wrote your code. The CrcLib error functionality indicates

The CrcLib error code functionality require the use of the following CrcLib functions at some point of your .ino file in order to work properly:

What happens when CrcDuino goes into Error mode?

  1. All Digital outputs are forced to LOW.

  2. All PWM outputs are forced to 0.

  3. The CrcDuino board mounted “FAIL” LED lights up.

  4. If the CrcDuino is connected to a computer, a Serial Monitor has been initialized and is opened, the Error description is printed on it.

  5. The CrcDuino Neopixel LED flashes and the buzzer buzzes in the pattern specified below, indicating what caused the error.

Only one error cause can trigger the Error mode at a time.

Neopixel and buzzer pattern signification

Combining the Buzzer and Neopixel pattern indicates the nature of the error that triggered the Error Code.

Buzzer pattern ID

Corresponding buzzer note pitch sequence

Buzzer pattern ID

Corresponding buzzer note pitch sequence

Pin Error

High - Low - High - Low

SPARE Error

Low - Low - Low - High

Value Error

Low - High - Middle

Servo Error

High - High - Low - Middle

Neopixel pattern ID

Corresponding Neopixel color sequence

Neopixel pattern ID

Corresponding Neopixel color sequence

Pattern 1

Short RED - Short RED - Long YELLOW

Pattern 2

Short MAGENTA - Short CYAN - Short MAGENTA

Pattern 3

Long CYAN - Long RED

Pattern 4

Short YELLOW - Long MAGENTA

Error ID

Buzzer pattern

Neopixel pattern

Error name

Error description

Error ID

Buzzer pattern

Neopixel pattern

Error name

Error description

1

Pin Error

Pattern 1

Unsafe Digital Pin

The given pin was not a safe digital pin.

2

Pin Error

Pattern 2

Unsafe Analog Pin

The given pin was not a safe analog pin.

3

Pin Error

Pattern 3

Unsafe PWM Pin

The given pin was not a safe PWM pin.

4

Pin Error

Pattern 4

Unsafe PWM / Digital Pin

The given pin was neither a safe PWM or digital pin.

 

 

 

 

 

10

SPARE Error

Pattern 1

SPARE10

Not used

11

SPARE Error

Pattern 2

SPARE11

Not used

12

SPARE Error

Pattern 3

SPARE12

Not used

 

 

 

 

 

20

Value Error

Pattern 4

Incorrect Digital Value

The given value was not LOW or HIGH.

 

 

 

 

 

30

Servo Error

Pattern 1

Servo Already Initialized

Trying to initialize a servo (PWM pin) which has already been initialized.

31

Servo Error

Pattern 2

Servo Not Initialized

Trying to use a servo (PWM pin) which has not been initialized.

32

Servo Error

Pattern 3

Incorrect Servo Pulse Widths

The given servo pulse widths are invalid. minPulseWidth must be less than maxPulseWidth, and both must be greater than 0.

Related articles