Arduino Millis( ) Function | Reset to Zero(0) | Best Video

preview_player
Показать описание
In this video you'll learn about how to reset millis() function of arduino.

...................................................................................

Code for resetting millis():

Write before void setup:
extern volatile unsigned long timer0_millis;

Write this to reset where you want the millis() to reset:
noInterrupts ();
timer0_millis = 0;
interrupts ();

...................................................................................

Please,

SUBSCRIBE | LIKE | SHARE

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

One of the best simple solutions on Youtube. Thank you sir

evouae
Автор

Thank u bro... Your video solved my problem...

openime
Автор

come for millis problem, stay for gaming videos 👌

enricofr
Автор

Thank you. Videos like this really help get my head around some of the problems I've been having.

ClipheApex
Автор

Thanx a lot The Dark Knight it work exactly as I wanted it to work.
I've watched so many video on this topic but couldn't find the proper solution.
But this one works.
Thanx a lot

sardarmaltanwar
Автор

Well done, simple but huge usage thanks again

danaberezenjy
Автор

so pleaase help me understand something, to reset millis i have to use this declaration
" extern volatile unsigned long timer0_millis" ? so if i use any other thing or word like "extern volatile unsigned long reset_millis" it wont work ? because i tried it and it didnt recognise the declaration....


and also please why did you put it in that order i.e ?
nointerrupts();
timer0_millis=0;
interrupts();


cant one just write only
timer0_millis=0;
interrupts();
?
and lastly is this variable timer0_millis=0; that important when resetting millis or we can use others?

thank you

Sony-ilti
Автор

This means that it has to be looking at it in that 8millisecods or it wont reset? What if tyhe code is working in a function and it is after both of those conditions?

bobbevins
Автор

Thanks for the video! It works very well!

Poshoo
Автор

Hello Mate,
Does it mean that you do not have to restart the board after 49 days? You only put in the code e.g after 30days elapsed or any action triggered and millis() starts counting from zero?
Thanks!

TomTom-tyej
Автор

What if I have a code for a timer and I just want it to interrupt once. I don't want to keep it saying 0, 0, 0.

MarioRodriguez-grwc
Автор

what the code for esp32 would be?, since it changes to esp_timer_get_time();, how do I restart it?. thanks

dantesdantes