The millis() function is often a struggle for newcomers to understand. This is a very useful and practical set of examples. Could have mentioned the roll-over after around 50 days just for completeness, but that is a minor point
Thank you for explaining Millis I am building an automated Dust Collection system for my wood shop, when I turn on as an example the table saw the dust collector will start after the blast gate opens. I am using a sketch that Bob Clagget wrote for this purpose. I have had to make changes for the sketch to work for me. Several times he used the millis function. I am now better able to grasp what the sketch is doing. When you are new to the Arduino and not a code writer learning can be a steep hill. The electrical part is easy for more me.it learning the code that is a challenge. Again thank You
great video... this is a nice way to have different timed actions to happen from one button input. the longer the button is pushed 1-5 seconds more event steps thanks...:)
I am impressed by your coaching will you pl guide me for reading data from keypad and lcdI2C to use to drive stepper say indeed pulse "x" required to run stepper to that x steps
Great video as always, thank you. I have a question if anyone can help, is there a way to force the program to restart from the beginning if no a laps of time has passed while waiting for user's input. let's say I am ask the user to pick a product from a list then he needs to pay for the product and sometimes the user change his mind and walks away, the program stays at the same prompt how can I use millis to cancel the operation and start again.
Hello, here is the timer using millis with push button to restart ruclips.net/video/6DGQhQgr7Ak/видео.html and you can change it NOT to restart. just stop or whatever you want
You are welcome. The best thank you for me is to not skippin the ads and Subscribe 🔔 to my channel, like 👍 the video and do not skip the ads.. It is greatly appreciated. 🔔 😊. I will reply to all Subscriber's 🔔 questions. So make sure to Subscribe.😊 .
i would like to ask about the millis and the pushbutton? if I put 2 pushbutton and using millis that if either one them will be push the other one will be disable like whatever push must be done in second button it will never able to send data until a certain seconds is pass and it will be available again for both of the push button.? and how would it be code it if it possible?
Hi, the condiation you are asking needs a full project. you may look at this video which is showing how to have LED blink without a delay ruclips.net/video/obBX9hyH5mM/видео.html
Hi, I can blink the led once with the delay function in the code below. How can I manage it with millis? Thx. while(sayac < 1 ) { Serial.print("sayac:");Serial.println(sayac); digitalWrite(2, HIGH); delay(5000); digitalWrite(2, LOW); delay(5000); sayac++; }
I have esp 8266 nodemcu with 4 relay board and 18b20 temp sensor I need relay 1 to activate when temp reach 80F and de active when temp reach 65F Relay 2 need to activate after 2 minutes when power up to the nodemcu Relay 3 need to activate every 4 hrs for 30 minutes but when really 3 actives, relay 1 and 2 must be de active for 30 minutes Then relay 1 will wait 1 minute then active again and relay 2 will wait for 2 minutes to active again I seen your millis function video so I though this can be done do you think you can make some kind of video to cover this kind of time event? Thanks
Hi there :-) I need some help with my coding. I would like to run a few motors and sweep a servo with one push button from and Arduino Mega board. I have tried using if statement for the push button and millis function for after the button is pushed and separating the operation of each component with different time in millis.I might have made a mistake or I could have forgotten something. Can somebody help me please or is there maybe an example sketch that I can work from?
Hello , can i use two functions at same time ? , first function is for running DS18B20 use millis() , seconde fonction while (for running stepper motors and many security sensors , thanks
have you watch my other video on this? Blinking LED with millis()? See it here ruclips.net/video/rUtDfadf8Jk/видео.html and here the Robojax Timer V1 ruclips.net/video/6DGQhQgr7Ak/видео.html
what do you mean by "separate tab"? we use millis() so we can do something else. here is my video with more examples ruclips.net/video/rUtDfadf8Jk/видео.html
Thank you for explanation, Sir. I want to know, weather millis function can be used for RCWL sensor or not. I tried but nit succeeded. Can U plz guide me. Code as below and I want sensorVal=1 for 5 min int =rcwlPin=2; int=sensorVal; cosnt unsigned long Interval=1000*60%5; unsigned long PreviousTime=0; void setup(){ pinMode(rcwlPin,INPUT); Serial.begin(9600); void setup(){ sensorVal=digitalWrite(rcwlPin); millis()=unsigned long CurrentTime; if(sensorVal==1){ if (CurrentTime-PreviousTime>=Interval){ sensorval==1 PreviousTime=CurrentTime; } } else { (sensorVal==0) } Serial.println(sensorVal); ) I upload this sketch, but not getting desired result. Kindly resolve it. Thank you
Hi, Please see this blink example video ruclips.net/video/rUtDfadf8Jk/видео.html and try your code to turn ON and OFF LED first. once it works, then use your sensor.
Thanks for your excellent presentations. I have a question. Please answer. It seems that once I want to download a code it downloads an html file. Is there a way to download your code as text file?
Hello, you just copy the code and past it in Arduino. That is pure code. but if you want to use in microsoft word, then paste it into notepad which removes all formatting and then copy it from notepad and then past it into Microsoft word.
You are welcome. The best thank you for me is to subscribe to my channel. Your subscription is stamp of approval and my videos will be suggested to more people and this will help me. I appreciate it. thanks❤️
Sir i am using the photosensors to blink the led light. So my project is blink the led light every seconds the photosensor is covered. How can i do that?
Is it possible for 2 sensors namely S1 and S2 to light up LED in "OR function" namely Output1??? If S1 is triggered output1 lights up for 10seconds and then switch off Same goes for S2 it lights up same output1 for 10seconds and switch off after.. But within or less than 10 seconds, while output1 is switch on any of the 2 sensors (s1 or s2) was triggered again, it will restart count 10 seconds and then switches off.. Example, s1 was triggered, so output1 lights up, after 3 seconds s2 was triggered or s1 was triggered again, so it makes 13 seconds output1 switches on and then switches off.... Is it possible using millis? Thanks for possible code and sorry for bad english
Anyone please help me My problem - using 3 led First led glow 10 sec and other both is low and then after 5 sec led glow 2 for 10 min then 5 sec delay then 3rd led glow for 10 sec and 1 st and 2nd off
if (digitalRead(bPin)==LOW){ if (currentMillis = millis() + (unsigned long) waitTime){
// The code above is where im having trouble: If the button is // low i want a delay of 10 seconds before writing the LED high. //The LED is high as soon as button is low without a 10 second delay. HELP!!!!!
você poderia me ajudar? Eu estou tentando fazer um led piscar, mas eu quero controlar o tempo que é alto e o tempo que é baixo, mas eu estou tendo dificuldade, seria interessante para um próximo vídeo sobre milles () parte 2 Aqui está o sketch: unsigned long previousmillis_led_low=0; unsigned long previousmillis_led_high=0; int one_second=1000; int two_seconds=2000; void setup() { Serial.begin(9600); } void loop() { unsigned long currentmillis=millis(); int status_led=LOW; if(status_led == LOW){//it's off? if(currentmillis-previousmillis_led_low == two_seconds){//is LOW for more than 2 seconds? previousmillis_led_low = currentmillis; status_led = HIGH; Serial.println("status_led_high: "); } } else{//--------------- so it's on if(currentmillis-previousmillis_led_b_high == one_second){// is HIGH for more than 1 seconds? previousmillis_led_b_high = currentmillis; status_led = LOW; Serial.println("status_led_low: "); } } }//void loop
bonjour, auriez-vous une piste pour créer un millis ou autre en boucle avec un temps défini (qui redémarrerait automatiquement et ou on peut intégrer des ordres sur différentes sorties pwn (ordre de mise en route selon une plage défini) exemple temps en boucle de 0 a 36000seconde déclenchement de la sortie pwn 2 de 65 a 85 secondes déclenchement de la sortie pwn 4 de 180 a 260 seconde déclenchement de la sortie pwn 2 de 600 a 900 seconde merci par avance
Bonjour, vous pouvez regarder ce Blink en utilisant Millis avec des heures ON et OFF différentes: ruclips.net/video/rUtDfadf8Jk/видео.html et écrire votre propre code.
The millis() function is often a struggle for newcomers to understand. This is a very useful and practical set of examples. Could have mentioned the roll-over after around 50 days just for completeness, but that is a minor point
Yes indeed. I believe I've mentioned it in another video about the limitation of counter. Thanks and stay safe.
Thank you for explaining Millis I am building an automated Dust Collection system for my wood shop, when I turn on as an example the table saw the dust collector will start after the blast gate opens. I am using a sketch that Bob Clagget wrote for this purpose.
I have had to make changes for the sketch to work for me. Several times he used the millis function. I am now better able to grasp what the sketch is doing. When you are new to the Arduino and not a code writer learning can be a steep hill. The electrical part is easy for more me.it learning the code that is a challenge. Again thank You
You are welcome. I am glad you found it useful.
Thank you for this video, it has helped me grasp the subject much better!
Thank you a lot. this was very effective tutorial and much better than other videos out there, very very effective. I got my code to work!
great video... this is a nice way to have different timed actions to happen from one button input. the longer the button is pushed 1-5 seconds more event steps thanks...:)
Ans here is an example of LED On and off each with different time ruclips.net/video/rUtDfadf8Jk/видео.html
Great tutorial. Thanks ROBOJAX, now I know what's the "millis()" function is for Arduino script.
You are welcome. Pleased to hear you found it useful.
Good example, great tutorial........thanks...
very well explained, thanks Robojax!
You are welcome.
I am impressed by your coaching will you pl guide me for reading data from keypad and lcdI2C to use to drive stepper say indeed pulse "x" required to run stepper to that x steps
Great video as always, thank you. I have a question if anyone can help, is there a way to force the program to restart from the beginning if no a laps of time has passed while waiting for user's input. let's say I am ask the user to pick a product from a list then he needs to pay for the product and sometimes the user change his mind and walks away, the program stays at the same prompt how can I use millis to cancel the operation and start again.
Hello, here is the timer using millis with push button to restart ruclips.net/video/6DGQhQgr7Ak/видео.html and you can change it NOT to restart. just stop or whatever you want
Jazak Allah khair
و ایاکم.
here is free Arduino Step by Step Course (over 100 video lectures) Starts here robojax.com/L/?id=338
رائع ومبدع استاذ احمد
شكرا لك. أنا سعيد لأنك أحببته.
Detailed explanation. Very clear with good examples. Great tutorial.
Thank you.
You are welcome.
Thank You!...😃😃😃
You are welcome. here is free Arduino Step by Step Course (over 100 video lectures) Starts here robojax.com/L/?id=338
@@robojax wow. Great. Thanks. I'll check... 😊👍👍
Thank you so much Mr Robojax.
You are welcome. The best thank you for me is to not skippin the ads and Subscribe 🔔 to my channel, like 👍 the video and do not skip the ads.. It is greatly appreciated. 🔔 😊.
I will reply to all Subscriber's 🔔 questions. So make sure to Subscribe.😊 .
Great tutor. Thank you so much sir.
you are welcome. here is the full video with practical example ruclips.net/video/obBX9hyH5mM/видео.html
i would like to ask about the millis and the pushbutton?
if I put 2 pushbutton and using millis that if either one them will be push the other one will be disable like whatever push must be done in second button it will never able to send data until a certain seconds is pass and it will be available again for both of the push button.? and how would it be code it if it possible?
Hi, the condiation you are asking needs a full project. you may look at this video which is showing how to have LED blink without a delay ruclips.net/video/obBX9hyH5mM/видео.html
Hi, I can blink the led once with the delay function in the code below. How can I manage it with millis? Thx.
while(sayac < 1 ) {
Serial.print("sayac:");Serial.println(sayac);
digitalWrite(2, HIGH);
delay(5000);
digitalWrite(2, LOW);
delay(5000);
sayac++;
}
Hi, under all my videos in the description I have links to related videos. and I have video on that.
THANK YOU
you are welcome.
I have esp 8266 nodemcu with 4 relay board and 18b20 temp sensor
I need relay 1 to activate when temp reach 80F and de active when temp reach 65F
Relay 2 need to activate after 2 minutes when power up to the nodemcu
Relay 3 need to activate every 4 hrs for 30 minutes but when really 3 actives, relay 1 and 2 must be de active for 30 minutes
Then relay 1 will wait 1 minute then active again and relay 2 will wait for 2 minutes to active again
I seen your millis function video so I though this can be done
do you think you can make some kind of video to cover this kind of time event?
Thanks
Hello, relay timer video is here ruclips.net/video/6DGQhQgr7Ak/видео.html
Hi there :-) I need some help with my coding.
I would like to run a few motors and sweep a servo with one push button from and Arduino Mega board.
I have tried using if statement for the push button and millis function for after the button is pushed and separating the operation of each component with different time in millis.I might have made a mistake or I could have forgotten something.
Can somebody help me please or is there maybe an example sketch that I can work from?
Hello , can i use two functions at same time ? , first function is for running DS18B20 use millis() , seconde fonction while (for running stepper motors and many security sensors , thanks
have you watch my other video on this? Blinking LED with millis()? See it here ruclips.net/video/rUtDfadf8Jk/видео.html and here the Robojax Timer V1 ruclips.net/video/6DGQhQgr7Ak/видео.html
Great tutorial Robojax, Salam from Malaysia
Walaikum salam, I am sorry for late reply. I was on vacation. Thank you.
Is it possible to make delay function in separate tab and use millis single line command like delay? For make code more simpler
what do you mean by "separate tab"? we use millis() so we can do something else. here is my video with more examples ruclips.net/video/rUtDfadf8Jk/видео.html
Thank you sir...
you are welcome. I hope you've subscribed as your subscription help my channel grow. Thanks
Thank you for explanation, Sir. I want to know, weather millis function can be used for RCWL sensor or not. I tried but nit succeeded. Can U plz guide me. Code as below and I want sensorVal=1 for 5 min
int =rcwlPin=2;
int=sensorVal;
cosnt unsigned long Interval=1000*60%5;
unsigned long PreviousTime=0;
void setup(){
pinMode(rcwlPin,INPUT);
Serial.begin(9600);
void setup(){
sensorVal=digitalWrite(rcwlPin);
millis()=unsigned long CurrentTime;
if(sensorVal==1){
if (CurrentTime-PreviousTime>=Interval){
sensorval==1
PreviousTime=CurrentTime;
}
}
else
{ (sensorVal==0)
}
Serial.println(sensorVal);
)
I upload this sketch, but not getting desired result.
Kindly resolve it. Thank you
Hi, Please see this blink example video ruclips.net/video/rUtDfadf8Jk/видео.html and try your code to turn ON and OFF LED first. once it works, then use your sensor.
Thank you sir for sharing this
You are welcome.
Thanks for your excellent presentations. I have a question. Please answer. It seems that once I want to download a code it downloads an html file. Is there a way to download your code as text file?
Hello, you just copy the code and past it in Arduino. That is pure code. but if you want to use in microsoft word, then paste it into notepad which removes all formatting and then copy it from notepad and then past it into Microsoft word.
@@robojax Lot of thanks. I have done it now.
Good job sir u explained it very easily
You are welcome.
Thanks so much!
You are welcome. The best thank you for me is to subscribe to my channel. Your subscription is stamp of approval and my videos will be suggested to more people and this will help me. I appreciate it. thanks❤️
Thanks, Great tutor
I.e code to read "say "pulse is 200 fed by keypad to lcd I2c to rum steeper to 200 pulse
Please see millis full details here ruclips.net/video/obBX9hyH5mM/видео.html
Sir i am using the photosensors to blink the led light. So my project is blink the led light every seconds the photosensor is covered. How can i do that?
Please check the link to blik using millis in the description.
can any help me for the code for led matrix 7*12. which show falling rain drops.
Hi, sorry I am very busy
Another great video 👍
Thanks again!
Is it possible for 2 sensors namely S1 and S2 to light up LED in "OR function" namely Output1??? If S1 is triggered output1 lights up for 10seconds and then switch off
Same goes for S2 it lights up same output1 for 10seconds and switch off after.. But within or less than 10 seconds, while output1 is switch on any of the 2 sensors (s1 or s2) was triggered again, it will restart count 10 seconds and then switches off..
Example, s1 was triggered, so output1 lights up, after 3 seconds s2 was triggered or s1 was triggered again, so it makes 13 seconds output1 switches on and then switches off.... Is it possible using millis? Thanks for possible code and sorry for bad english
Yes it is doable. I have two videos on millis() and used it on lots of projects on my channel. You would have to have patience and play with it.
@@robojax ok thanks ill watch your videos thanks
Anyone please help me
My problem - using 3 led
First led glow 10 sec and other both is low and then after 5 sec led glow 2 for 10 min then 5 sec delay then 3rd led glow for 10 sec and 1 st and 2nd off
one push button used one led blinking in millis program video required sir.pls
what does the push button do? Start or reset?
I can read all comments on ONE page. So wherever you post it, I can read them.
thanks for the great video!
Glad you liked it!
robojax ,,,,best for the reason
Thank you Rohit. I do my best. I am glad you found it useful.
@@robojax i should thank you sir ,,for your superb content videos
Thanks for sharing
You are welcome.
thanks
You are welcome. here is the a better video with example which is part of my Arduino course ruclips.net/video/obBX9hyH5mM/видео.html
I MAKE A CODE IN ARDUINOTO READ DUTY CYCLE . BUT ARDUINO CANNOT READ DUTY AND FREQUENCY FROM 1 Hz to 30Hz
what is the solution
When you use UPPERCASE text you are screaming 😱.
and it is hard to read
@@robojax I make a code in arduino uno to read frequency and duty cycle. But arduino cannot read from 1Hz to 30Hz and its duty cycle
if (digitalRead(bPin)==LOW){
if (currentMillis = millis() + (unsigned long) waitTime){
// The code above is where im having trouble: If the button is
// low i want a delay of 10 seconds before writing the LED high.
//The LED is high as soon as button is low without a 10 second delay.
HELP!!!!!
you are watching wrong video. Search for "millis" to see the other video.
muito obrigado :)
Você é bem vindo.
Sr. please make the code bellow becomes millis:
Void loop () {
if (digitaRead (tombol)==0){
digitalWrite (led, HIGH);
delay (3000);
digitalWrite (led, LOW);
delay (3000);
digitalWrite (led, HIGH);
delay (3000);
digitalWrite (led, HIGH);
delay (3000);
}
else {
digitalWrite (led, LOW);
}
}
How to be version millis Sr..???.
Hi, please watch the latest full video ruclips.net/video/obBX9hyH5mM/видео.html always search my channel you will find surprising contents
você poderia me ajudar? Eu estou tentando fazer um led piscar, mas eu quero controlar o tempo que é alto e o tempo que é baixo, mas eu estou tendo dificuldade, seria interessante para um próximo vídeo sobre milles () parte 2
Aqui está o sketch:
unsigned long previousmillis_led_low=0;
unsigned long previousmillis_led_high=0;
int one_second=1000;
int two_seconds=2000;
void setup() {
Serial.begin(9600);
}
void loop() {
unsigned long currentmillis=millis();
int status_led=LOW;
if(status_led == LOW){//it's off?
if(currentmillis-previousmillis_led_low == two_seconds){//is LOW for more than 2 seconds?
previousmillis_led_low = currentmillis;
status_led = HIGH;
Serial.println("status_led_high: ");
}
}
else{//--------------- so it's on
if(currentmillis-previousmillis_led_b_high == one_second){// is HIGH for more than 1 seconds?
previousmillis_led_b_high = currentmillis;
status_led = LOW;
Serial.println("status_led_low: ");
}
}
}//void loop
Oi, eu trabalhei no seu problema e fazendo vídeo nele. Em breve vou postar em cerca de uma semana.
@@robojaxobrigado pela ajuda, seus videos me ajudam muito
Você é bem vindo. Estou feliz em ouvir isso.
Oi, acabei de postar o piscar usando vídeo millis ruclips.net/video/rUtDfadf8Jk/видео.html
emoneySwag nice drip
To reset millis() to 0, here is a video:
ruclips.net/video/3Du1n2VRA68/видео.html
Your comment was in the "likely Spam" and I approved it. Usually I delete them but this is useful. Thanks
bonjour,
auriez-vous une piste pour créer un millis ou autre en boucle avec un temps défini (qui redémarrerait automatiquement et ou on peut intégrer des ordres sur différentes sorties pwn (ordre de mise en route selon une plage défini)
exemple
temps en boucle de 0 a 36000seconde
déclenchement de la sortie pwn 2 de 65 a 85 secondes
déclenchement de la sortie pwn 4 de 180 a 260 seconde
déclenchement de la sortie pwn 2 de 600 a 900 seconde
merci par avance
Bonjour, vous pouvez regarder ce Blink en utilisant Millis avec des heures ON et OFF différentes: ruclips.net/video/rUtDfadf8Jk/видео.html et écrire votre propre code.