mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
48 lines
804 B
Arduino
48 lines
804 B
Arduino
|
//
|
||
|
// FILE: milliSeconds.ino
|
||
|
// AUTHOR: Rob Tillaart
|
||
|
// VERSION: 0.1.0
|
||
|
// PURPOSE: demo
|
||
|
// DATE: 2020
|
||
|
// URL: https://github.com/RobTillaart/timing
|
||
|
//
|
||
|
|
||
|
#include "timing.h"
|
||
|
|
||
|
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...");
|
||
|
}
|
||
|
|
||
|
void loop()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
// -- END OF FILE --
|