/
StopEverythingFromError

StopEverythingFromError

Purpose

Stop the execution of the CrcDuino with an error code and error tune.

When to use

When you want to catch a programming error.

Where to use

Inside the loop function, when an unexpected event has occured.

Returns

Never returns, goes on and on and on, for ever and ever, at vitam æternam.

Main prototype and parameters

void CrcLib::StopEverythingFromError(const Note notes[], const ColorDuration colors[])

The following parameters must be passed to the function for it to work properly:

  • A sequence of notes to play repeatedly (use it to distinguish from other errors)

  • A sequence of colors to display repeatedly

Overloads

This function does not have any overloads. It can only be used as described by the main prototype.

Examples

#include <CrcLib.h> // See the page about Note and ColorDuration // Define some color pattern using { <duration in ms>, <color> } ColorDuration pattern_error[] = { { 250, Color(213, 4, 30) }, { 250, NO_COLOR }, { 1000, BLUE_LOW }, ColorDuration::END }; // And some song using { <duration in ms>, <note frequency in Hz> } Note notes_error[] = { { 250, NOTE_B4 }, { 500, NOTE_F5 }, Note::END }; void setup() { CrcLib::Initialize(); } void loop() { CrcLib::Update(); if (2 > 1) { // some terrible, unforgivable error CrcLib::StopEverythingFromError(notes_error, pattern_error); } }

Related articles

Related content

StopEverythingFromError {FR}
StopEverythingFromError {FR}
More like this
PlayTune
More like this
PlayTune {FR}
More like this
Initialize()
More like this
Update()
More like this