![]() Again, there's the alternative elapsedMicros for higher precision, from the same library. Looking into the source code of elapsedMillis reveals that it indeed uses millis() internally to compare two points in time, so it suffers from this effect as well. Use micros() if higher precision is needed. ![]() That means that, when calculating the difference between two results from millis(), you can be off by anything between almost zero and almost one millisecond. It's possible that the "current" millisecond just started, or that it will end right after that function call. When millis() is called, the implementation returns some value, but you don't know how old that actually is. Millis() usually relies on a hardware timer that runs at a speed that's much higher than 1 kHz. ![]() However when using delays instead, it seems to work perfectly fine Problem is, is that I cannot use delays for my project and need to use the timer interrupts. When using timer interrupts, the Arduino seems to miss most of the samples.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |