GY-63_MS5611/libraries/Stopwatch_RT/examples/stopwatch_resolution/stopwatch_resolution.ino

54 lines
985 B
Arduino
Raw Normal View History

2021-01-29 06:31:58 -05:00
//
// FILE: stopwatch_resolution.ino
// AUTHOR: Rob Tillaart
// PURPOSE: sample demo stopwatch class
// DATE: 2020-05-08
// URL: https://github.com/RobTillaart/StopWatch_RT
2021-12-28 11:04:43 -05:00
2021-01-29 06:31:58 -05:00
#include <StopWatch.h>
StopWatch MySW;
2021-12-28 11:04:43 -05:00
2021-01-29 06:31:58 -05:00
void setup()
{
Serial.begin(115200);
Serial.println(__FILE__);
Serial.println(STOPWATCH_LIB_VERSION);
MySW.start();
delay(5000);
Serial.print("TIME: ");
Serial.println(MySW.elapsed());
Serial.print(" RES: ");
Serial.println(MySW.resolution());
Serial.println();
}
2021-12-28 11:04:43 -05:00
2021-01-29 06:31:58 -05:00
void loop()
{
simple_test(StopWatch::MICROS);
simple_test(StopWatch::MILLIS);
simple_test(StopWatch::SECONDS);
simple_test(StopWatch::MINUTES);
}
void simple_test(StopWatch::Resolution res)
{
MySW.setResolution(res); // note: includes an automatic reset()
MySW.start();
delay(2500);
Serial.print("TIME: ");
Serial.println(MySW.elapsed());
Serial.print(" RES: ");
Serial.println(MySW.resolution());
Serial.println();
}
2021-12-28 11:04:43 -05:00
2021-01-29 06:31:58 -05:00
// -- END OF FILE --
2021-12-28 11:04:43 -05:00