-
Notifications
You must be signed in to change notification settings - Fork 8
Examples Filters
Luis Llamas edited this page Apr 25, 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(9600);
while (!Serial) delay(1);
Reactive::FromArray<int>(values, valuesLength)
>> Reactive::OnFalling<int>() //OnRising or OnFalling
>> Reactive::ToSerial<int>();
}
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(9600);
while (!Serial) delay(1);
Reactive::FromArray<int>(values, valuesLength)
>> Reactive::Median3<int>() // Median3 or Median5
>> Reactive::ToSerial<int>();
}
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(9600);
while (!Serial) delay(1);
Reactive::FromArray<int>(values, valuesLength)
>> Reactive::MovingAverage<int>(4) //MovingAverage or MovingRMS
>> Reactive::ToSerial<int>();
}
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(9600);
while (!Serial) delay(1);
Reactive::FromArray<int>(values, valuesLength)
>> Reactive::Cast<int, float>()
>> Reactive::LowPass<float>(0.4) //LowPass or HighPass
>> Reactive::ToSerial<float>();
}
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(9600);
while (!Serial) delay(1);
Reactive::FromArray<int>(values, valuesLength)
>> Reactive::Cast<int, float>()
>> Reactive::PassBand<float>(0.35, 0.65) //PassBand or StopBand
>> Reactive::ToSerial<float>();
}
void loop()
{
}#include "ReactiveArduinoLib.h"
auto observableInt = Reactive::FromProperty<int>();
void setup()
{
Serial.begin(9600);
while (!Serial) delay(1);
observableInt
>> Reactive::DebounceMillis<int>(25) //DebounceMillis or DebounceMicros
>> Reactive::ToSerial<int>();
}
void loop()
{
delay(2000);
observableInt = 1;
delay(10);
observableInt = 2; // Debounce ignore this
delay(5);
observableInt = 2; // Debounce ignore this
delay(100);
observableInt = 3;
}#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(9600);
while (!Serial) delay(1);
Reactive::FromArray<int>(values, valuesLength)
>> Reactive::IsGreater(3)
>> Reactive::ToSerial<int>();
}
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(9600);
while (!Serial) delay(1);
Reactive::FromArray<int>(values, valuesLength)
>> Reactive::IsZero<int>()
>> Reactive::ToSerial<int>();
}
void loop()
{
}