I have write a code for delay function for different uses. Every one"void loop()" function I call a function in a library class with “for loop” from 0 to 100millisecods with 4++ at tow time delay 2ms, as shown below.
however every main void loop () I print the time [ whish is 100ms ] for test, when I opened the serial monitor and start a chronometer on laptop or phone , I encountered an error of 5 seconds after 4 min (which is different between serial monitor and chronometer) and 12s error after 8 min and so on the more the time pass the more the difference error … however this is huge error I dont know why their is such error in delay, I want a maximum error of 1 second after 5 hours. kindly advice
The functions I writted in the test below
////////// IN MAIN CLASS
times+=1;// Equal to 100 millisecond
Astro.SiderealRate(); // THIS IS A LIBRARRY
A FUNCTION IN THE LIBRARY