2021-01-29 06:31:58 -05:00
|
|
|
//
|
|
|
|
// FILE: milliSeconds.ino
|
|
|
|
// AUTHOR: Rob Tillaart
|
|
|
|
// PURPOSE: demo
|
|
|
|
// URL: https://github.com/RobTillaart/timing
|
|
|
|
|
2021-05-28 07:47:03 -04:00
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
#include "timing.h"
|
|
|
|
|
2021-05-28 07:47:03 -04:00
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
void setup()
|
|
|
|
{
|
|
|
|
Serial.begin(115200);
|
|
|
|
Serial.println(__FILE__);
|
|
|
|
delay(10);
|
|
|
|
|
|
|
|
milliSeconds mis; // starts at zero
|
|
|
|
for (uint32_t i = 0; i < 1000; i++)
|
|
|
|
{
|
|
|
|
Serial.print(i);
|
|
|
|
Serial.print("\t");
|
|
|
|
Serial.println(i*i);
|
|
|
|
}
|
|
|
|
uint32_t x = mis.now();
|
|
|
|
Serial.print("milliseconds:\t");
|
|
|
|
Serial.println(x);
|
|
|
|
|
|
|
|
mis.set(0); // starts at zero
|
|
|
|
for (uint32_t i = 0; i < 1000; i++)
|
|
|
|
{
|
|
|
|
Serial.print(i);
|
|
|
|
Serial.print("\t");
|
|
|
|
Serial.println(i*i);
|
|
|
|
}
|
|
|
|
x = mis.now();
|
|
|
|
Serial.print("milliseconds:\t");
|
|
|
|
Serial.println(x);
|
|
|
|
|
|
|
|
Serial.println("\nDone...");
|
|
|
|
}
|
|
|
|
|
2021-05-28 07:47:03 -04:00
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
void loop()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2021-05-28 07:47:03 -04:00
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
// -- END OF FILE --
|
2021-12-29 05:16:45 -05:00
|
|
|
|