2022-11-17 11:36:35 -05:00
|
|
|
//
|
|
|
|
// FILE: minmax_new.ino
|
|
|
|
// 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__);
|
|
|
|
|
2022-12-07 08:58:50 -05:00
|
|
|
mm.setAutoResetCount(10000);
|
2022-11-17 11:36:35 -05:00
|
|
|
mm.addCallBack(display);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void loop()
|
|
|
|
{
|
|
|
|
int r = random(10001) - 5000;
|
|
|
|
mm.add(r);
|
|
|
|
}
|
|
|
|
|
2022-12-07 08:58:50 -05:00
|
|
|
|
2022-11-17 11:36:35 -05:00
|
|
|
void display()
|
|
|
|
{
|
|
|
|
Serial.print(mm.count());
|
|
|
|
Serial.print("\t");
|
|
|
|
Serial.print(mm.minimum());
|
|
|
|
Serial.print("\t");
|
|
|
|
Serial.print(mm.maximum());
|
|
|
|
Serial.print("\n");
|
|
|
|
}
|
|
|
|
|
2022-12-07 08:58:50 -05:00
|
|
|
|
|
|
|
// -- END OF FILE --
|