GY-63_MS5611/libraries/infiniteAverage/examples/IA_test/IA_test.ino

50 lines
694 B
Arduino
Raw Normal View History

2021-01-29 06:31:58 -05:00
//
// FILE: IA_test.ino
// AUTHOR: Rob Tillaart
// PURPOSE: demo
// DATE: 2021-01-21
#include "infiniteAverage.h"
IAVG IA;
uint32_t lastTime = 0;
2021-05-28 07:34:28 -04:00
2021-01-29 06:31:58 -05:00
void setup()
{
Serial.begin(115200);
Serial.println(__FILE__);
IA.reset();
2021-12-20 10:20:02 -05:00
IA.setDivideThreshold(1024);
2021-01-29 06:31:58 -05:00
while (1)
{
IA.add(random(10000) * 0.0001);
2021-12-20 10:20:02 -05:00
if (millis() - lastTime >= 500)
2021-01-29 06:31:58 -05:00
{
lastTime = millis();
Serial.print(IA.count());
Serial.print("\t");
Serial.print(IA.whole());
Serial.print("\t");
Serial.print(IA.decimals(), 5);
Serial.print("\t\t");
Serial.print(IA.average(), 7);
Serial.print("\n");
}
}
}
2021-05-28 07:34:28 -04:00
2021-01-29 06:31:58 -05:00
void loop()
{
}
2021-05-28 07:34:28 -04:00
2021-01-29 06:31:58 -05:00
// -- END OF FILE --
2021-12-20 10:20:02 -05:00