-
Notifications
You must be signed in to change notification settings - Fork 8
Examples Filters
Luis Llamas edited this page Aug 26, 2019
·
6 revisions
#include "ReactiveArduinoLib.h"
int values[] = { 0, 1, 1, 2, 1, 5, 4, 2, 6, 2, 4 };
size_t valuesLength = sizeof(values) / sizeof(values[0]);
void setup()
{
Serial.begin(115200);
while (!Serial) delay(1);
Reactive::FromArray(values, valuesLength)
.OnFalling() //OnRising or OnFalling
.ToSerial();
}
void loop()
{
}
#include "ReactiveArduinoLib.h"
int values[] = { 0, 1, 1, 2, 1, 5, 4, 2, 6, 2, 4 };
size_t valuesLength = sizeof(values) / sizeof(values[0]);
void setup()
{
Serial.begin(115200);
while (!Serial) delay(1);
Reactive::FromArray(values, valuesLength)
.Median3() // Median3 or Median5
.ToSerial();
}
void loop()
{
}
#include "ReactiveArduinoLib.h"
int values[] = { 0, 1, 1, 2, 1, 5, 4, 2, 6, 2, 4 };
size_t valuesLength = sizeof(values) / sizeof(values[0]);
void setup()
{
Serial.begin(115200);
while (!Serial) delay(1);
Reactive::FromArray(values, valuesLength)
.ToFloat()
.MovingAverage(4) //MovingAverage or MovingRMS
.ToSerial();
}
void loop()
{
}
#include "ReactiveArduinoLib.h"
int values[] = { 0, 1, 1, 2, 1, 5, 4, 2, 6, 2, 4 };
size_t valuesLength = sizeof(values) / sizeof(values[0]);
void setup()
{
Serial.begin(115200);
while (!Serial) delay(1);
Reactive::FromArray(values, valuesLength)
.Cast<float>()
.LowPass(0.4) //LowPass or HighPass
.ToSerial();
}
void loop()
{
}
#include "ReactiveArduinoLib.h"
int values[] = { 0, 1, 1, 2, 1, 5, 4, 2, 6, 2, 4 };
size_t valuesLength = sizeof(values) / sizeof(values[0]);
void setup()
{
Serial.begin(115200);
while (!Serial) delay(1);
Reactive::FromArray(values, valuesLength)
.Cast<float>()
.PassBand(0.35, 0.65) //PassBand or StopBand
.ToSerial();
}
void loop()
{
}
#include "ReactiveArduinoLib.h"
auto observableInt = Reactive::Property<int>();
void setup()
{
Serial.begin(115200);
while (!Serial) delay(1);
observableInt
.DebounceMillis(25) //DebounceMillis or DebounceMicros
.ToSerial();
}
void loop()
{
delay(2000);
observableInt = 1; // Print this
delay(10);
observableInt = 2; // Debounce make ignore this
delay(5);
observableInt = 2; // Debounce ignore this
delay(100);
observableInt = 3; // Print this
}
#include "ReactiveArduinoLib.h"
int values[] = { 0, 1, 1, 2, 1, 5, 4, 2, 6, 2, 4 };
size_t valuesLength = sizeof(values) / sizeof(values[0]);
void setup()
{
Serial.begin(115200);
while (!Serial) delay(1);
Reactive::FromArray(values, valuesLength)
.IsGreater(3)
.ToSerial();
}
void loop()
{
}
#include "ReactiveArduinoLib.h"
int values[] = { 0, 1, 1, 2, 1, 5, 4, 2, 6, 2, 4 };
size_t valuesLength = sizeof(values) / sizeof(values[0]);
void setup()
{
Serial.begin(115200);
while (!Serial) delay(1);
Reactive::FromArray(values, valuesLength)
.IsZero()
.ToSerial();
}
void loop()
{
}