ScopeMimicry Library allows to capture live data and variables.
Add the following to lib_deps
in platformio.ini
scopemimicry = https://github.com/owntech-foundation/scopemimicry.git
#include "ScopeMimicry.h"
Create your scope object
ScopeMimicry scope(sample_lenght, number_of_channels);
- Sample lenght is the number of data points per channel.
- Number of channel is the total number of channel acquired by the scope.
For example :
ScopeMimicry scope(512, 4);
Defines a scope with 4 channels and 512 data points per channel.
Channels are connected to variables using:
scope.connectChannel(variable, "channel_name");
For example:
scope.connectChannel(I1_low_value, "I1_low");
Make sure to connect as many channels as the number of channels set up in scope object.
Acquisition can be launched using :
scope.acquire();
Instead of using scope.acquire(), it is possible to trigger the scope with a given logic condition.
To do that :
Define a trigger function. The trigger function shoud not have any arguments. It should return a bool value, that will trigger the scope when returning 1.
For example :
bool a_trigger()
return (myVariable == 1)
Will trigger the scope when myVariable = 1
Once the trigger function created, set the trigger function
scope.set_trigger(&a_trigger);
A delay can be added to acquire a given amount of data before the trigger instant.
delay
should be a float between 0
and 1
.
scope.set_delay(0.0F);
Start the scope to begin data acquisition:
scope.start();