Arduino - Solve the Overflow Problem with millis() and micros()

preview_player
Показать описание
Understand what is the overflow problem with millis() and micros(), how to solve it using a specific code structure, and how to still be able to get the exact time since the beginning of the Arduino program.

0:00 Intro
0:13 Recap on millis() and micros()
0:54 The overflow issue with millis() and micros()
2:46 The way to use micros() and millis() in your code
4:19 Why this code structure solves the overflow problem
6:35 How to get the time since beginning of the program
7:12 Outro

Рекомендации по теме
Комментарии
Автор

Good explanation. I do not know why whenever people want to show how millis() works, buttons and leds and whatnots are used. The explanation using only code is ideal. Thank you!!!

johneagle
Автор

Thanks for the explanation! I’ve been racking my head for a week and as my test model can’t run for the amount of time needed to overflow I would have never found out until I got to full scale.

AutoAnomoly
Автор

So are you saying that we dont need to add any extra code to handle the overflow issue ? it is going to function normally even after the duration exceeds the maximum limit ?

ajayanchal
Автор

Thanks for the good explanation. I finally understood the problem with the overflow.

thomash.
Автор

i using uint64 for micros, the limit of uint64 is 2^64-1 (to prove it u can insert random number > 2^64-1 to uint64 variable and print to serial monitor ), but at the end its only show 2^32-1 and than return to 0.

soktahu
Автор

sometimes Accent problem is there when playing at 2x speed, in that case captions helps a lot So, please provide captions/subtitles in every videos

anoopsaxena
Автор

I had this issue and asked to chatGPT to correct and it created an overflow counter of millis function and solved the problem. Now my software can run forever

anlpereira
Автор

u didnt go to the end how to solve this puzzle by writing the code to the end.

tuom