SerialPrintChannels allows to register live float variables and stream either their header row or their current values over the serial console.
Place the library in your OwnTech lib folder or add it as a dependency in
your project layout.
#include "SerialPrintChannels.h"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);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();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.
To print the registered names:
print.printHeader();To print the current values:
print.printValues();Each call prints one full row terminated by \n.