2021-10-14 14:54:11 +02:00
|
|
|
//
|
2022-12-07 14:58:50 +01:00
|
|
|
// FILE: minmax_demo.ino
|
2021-10-14 14:54:11 +02:00
|
|
|
// AUTHOR: Rob Tillaart
|
|
|
|
// PURPOSE: demo
|
|
|
|
// URL: https://github.com/RobTillaart/minmax
|
|
|
|
|
|
|
|
|
|
|
|
#include "MINMAX.h"
|
|
|
|
|
|
|
|
|
|
|
|
MINMAX mm;
|
|
|
|
|
|
|
|
uint32_t start, stop;
|
|
|
|
|
|
|
|
|
|
|
|
void setup()
|
|
|
|
{
|
|
|
|
Serial.begin(115200);
|
|
|
|
Serial.println(__FILE__);
|
|
|
|
|
|
|
|
mm.reset();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void loop()
|
|
|
|
{
|
|
|
|
int r = random(1000) - 500;
|
2021-12-21 19:57:20 +01:00
|
|
|
|
2021-10-14 14:54:11 +02:00
|
|
|
mm.add(r);
|
|
|
|
if (mm.count() % 100 == 0)
|
|
|
|
{
|
|
|
|
Serial.print(mm.count());
|
|
|
|
Serial.print("\t");
|
|
|
|
Serial.print(mm.minimum());
|
|
|
|
Serial.print("\t");
|
|
|
|
Serial.print(mm.maximum());
|
2022-12-07 14:58:50 +01:00
|
|
|
Serial.print("\t");
|
|
|
|
Serial.print(mm.lastMin());
|
|
|
|
Serial.print("\t");
|
|
|
|
Serial.print(mm.lastMax());
|
2021-10-14 14:54:11 +02:00
|
|
|
Serial.print("\n");
|
|
|
|
mm.reset();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-12-07 14:58:50 +01:00
|
|
|
// -- END OF FILE --
|