mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
42 lines
728 B
C++
42 lines
728 B
C++
//
|
|
// FILE: sample2.ino
|
|
// AUTHOR: Rob Tillaart
|
|
// PURPOSE: sample demo stopwatch class
|
|
// DATE: 2011-01-04
|
|
// URL: https://github.com/RobTillaart/StopWatch_RT
|
|
|
|
|
|
#include <StopWatch.h>
|
|
|
|
|
|
StopWatch sw_millis; // MILLIS (default)
|
|
StopWatch sw_micros(StopWatch::MICROS);
|
|
StopWatch sw_secs(StopWatch::SECONDS);
|
|
|
|
|
|
void setup()
|
|
{
|
|
Serial.begin(115200);
|
|
sw_millis.start();
|
|
sw_micros.start();
|
|
sw_secs.start();
|
|
}
|
|
|
|
|
|
void loop()
|
|
{
|
|
Serial.print("sw_millis=");
|
|
Serial.print(sw_millis.elapsed());
|
|
Serial.print("\tsw_micros=");
|
|
Serial.print(sw_micros.elapsed());
|
|
Serial.print("\tsw_secs=");
|
|
Serial.print(sw_secs.elapsed());
|
|
Serial.println();
|
|
|
|
delay(1000);
|
|
}
|
|
|
|
|
|
// -- END OF FILE --
|
|
|