Skip to content

owntech-foundation/serial_print

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SerialPrintChannels

SerialPrintChannels allows to register live float variables and stream either their header row or their current values over the serial console.

Load library

Place the library in your OwnTech lib folder or add it as a dependency in your project layout.

Include the library

#include "SerialPrintChannels.h"

SerialPrintChannels Usage

Creating the printer

Create your print object:

SerialPrintChannels print;

By default, the active capacity is 10 channels.

You can also choose a different default capacity:

SerialPrintChannels print(16U);

Configuring the printer

The active number of printable channels can be changed with:

print.setCapacity(16U);

The separator used between fields can be changed with:

print.setSeparator(":");

To remove all registered channels:

print.clearChannels();

Connecting channels

Channels are connected directly from float variables using:

print.connectChannel(variable, "channel_name");

For example:

print.connectChannel(app.variable.V_high, "V_high");
print.connectChannel(app.variable.speed_ref, "speed_ref");

Channels are printed in the same order as they are connected.

Printing the header

To print the registered names:

print.printHeader();

Printing the values

To print the current values:

print.printValues();

Each call prints one full row terminated by \n.

About

A library for printing data over serial

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages