IsCommValid()

Purpose

Know if a remote controller connected to the CrcDuino via a CrcConnect module.

When to use

Whenever you need to check if the communication with the remote controller is up.

Where to use

In the void loop() part of your .ino file. The connection is not established when the void setup() part of your .ino file is executed.

Click here to learn more on the CrcConnect system, that allows to control a CrcDuino using popular off-the-shelf remote controllers.

This function requires the use of the following CrcLib functions at some point of your .ino file in order to work properly:

Returns

This function returns the status of the communication with a remote controller as a booltype.

  • LOW, if the connection is not established

  • HIGH, if the connection is established

Main prototype and parameters

static bool CrcLib::isCommValid();

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

  • No parameters needed.

Overloads

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

Examples

#include <CrcLib.h> using namespace Crc; void setup() { CrcLib::Initialize(); Serial.begin(2000000); //Open the serial monitor at a 2000000 baud rate /* The rest of your setup code ... */ } void loop() { CrcLib::Update(); if(CrcLib::isCommValid()) { Serial.println(":)"); } else { Serial.println(":("); } /* The rest of your looping code ... */ }

 

More on this function

A “physical” way to tell if the communication is established between the CrcDuino and the CrcConnect is to check if the board mounted “X2” LED is lit on the CrcDuino, or if the “COM” LED on the CrcConnect module is lit.

Related articles