Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

« Previous Version 2 Current »

Purpose

Print the received state of the controller attached to the CrcConnect.

When to use

When you want to verify if the CrcConnect has some issues.

Where to use

Inside the loop function, after having called Serial.begin in the setup.

This function requires Serial communication, so make sure you called Serial.begin in setup().

The Serial link takes some time to work its magic. Make sure you do not call this function every loop, for example by using a delay.

Returns

This function does not return a value once it has completed its tasks.

Main prototype and parameters

static void Crc::CrcLib::PrintControllerState()

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

 #1: Debug the state of the remote connection
#include <CrcLib.h>

using namespace Crc;

Timer timer;
void setup() {
    CrcLib::Initialize();
    
    // Setup the serial link
    Serial.begin(115200);
    
    // Start the timer with a period of 10 ms
    timer.Start(10);

    /* 
    The rest of your setup code
    ...
     */
}
void loop() {
    CrcLib::Update();
    
    if (timer.IsFinished()) { // 10 ms has elapsed
        timer.Next(); // Start the next period of the timer
        
        // Then print the controller state
        CrcLib::PrintControllerState();
    }
    
    /* 
    The rest of your looping code
    ...
    */
}

More on this function

There is sadly nothing more to be said about this function…

  • No labels