Man, You were born to teach people, the way You explain is Brilliant! Thank You and please keep doing such amazing videos. God bless You! Respect from Russia.
Well Done!!!This is one of the few videos that start by showing the viewer what is the purpose and will be achieved. WELL DONE!!! It is structured as it should be
This is the kind of explanation I've been looking for for a long time. I'm not even joking, you really did explain the millis function well, cuz I've been struggling with my final year project. But now I realized it was all in the delays. Thank you so much. You've made a new subscriber.
You saved me from many headaches down the road I thank you. I kinda wished I would of got to watch this video before starting my program awww we learning… thank you
a very elegant way of teaching, like being born to be so. The explanations exceed your reputation, man you live up to your name. huge: LIKE AND SUB. I will be your follower. thank you for your effort
like the way you, explain and your voice tone Can you make a tutorial also about the "Control Structures".. which includes if if...else for switch case while do... while break continue return goto
I want to write a code as below and I want to replace delay() function with millis(). Please can you tell me how to write code for this? " digitalWrite(column[0], LOW); delay(40); //wait for 40ms before start below statement digitalWrite(column[1], LOW); delay(40); digitalWrite(column[2], LOW); delay(40); digitalWrite(column[3], LOW); delay(40); "
Hi, I enjoyed your video on using Millis(), I would like to know if you have or will have a video on State Machines using Arduino. Thank you for any help you may be able to provide.
Hello when arduino receive angle (number) from Serail for exemple , the stepper motor dont finish distance to go (stop ) because Serial receive next angle . What should I do for arduino receive and let stepper motor finish distance Simultaneously ?
little bit confused. why "d" hasn't been declare in no one of part of sketch in first example (7segment display counter)? it already been in the "for" loop. and it's it.
I'm working on the challenge and I'm having problems on the seven segment display, counting backwards I was able to count from 9 to 0 but when it gets to 0 it does not restart, if I I press the switch it will reset to 9, but when it gets to 0 again same problem. Will it be possible if you post the solutions. Thank you.
You just have to create a variable that counts from 1 to 5 (increment by one every blink using the millis). Then you can add a condition that your blink code should only be performed while/if the counter
it seems very useful, but it's a bit confusing for me. Sir, I wonder if I can use it with 2 codes if there is an ''if'' and ''else" statement, for example, I have combined ultrasonic sensor and water level sensor but the program seems can't run properly. Can you help me, sir
It is normal to be confused when you first use this concept. It is okay to use if...else code block. You just have to understand when to properly use it. Using if...else.., only one of these code blocks gets executed at one time. But when you use, if.....if...if..., all conditions could be satisfied and be executed at one time.
would like a lesson about array and 2d array if you have time. Thanks. examples using 2D array with crystal LCD BIG FONTS for Clock. I am just a newbie to Arduino.
Professor, I have a request, sir 🙏, there are a lot of tutorials about atmega, Arduino and ESP8266 but *what about AT89s52 [8051 families]??* the AT89s52 is a very basic microcontroller that we read in our college, and my problem is "I'm making a digital clock [7-segment] using AT89s52 (NO RTC) but the time drifts about 5.6 seconds in every hour!! and this At89s52 microcontroller doesn't have any function like millis() inside AT89s52's IDE(Microvision Keil software), and a book suggests to play with the ppm and fix the error.But, yet the problem is At89s52 is not like Arduino , so Professor, I need your help, can u please make a dedicated video on this?? so that everyone will learn a lot, or u can also help me by writing about the solution below 🙏" BTW I'm using a 16MHz crystal with this microcontroller and using timer_0 to generate a 25ms delay and using interrupt_1 to count that 40times so that there will be 1 second completed, but that's not the problem I guess.. I just need your help.. .🙏🙏
actually there is a limitation. When your code gets long enough, and you have to keep the timing precise, this method does not work. As you can see that he used >= instead of ==, this is because as the loop goes on, it will skip a few count, so the longer it runs, the more errors it accumulates. It does not take long to get a 1000x of millis error and your system's diff becomes apparent.
Wow, Please help me with my problem with delay in my code digitalWrite(relay1, LOW);// turn relay 1 OFF digitalWrite(relay2, HIGH);// turn Serial.println("M1-CW");
Good Thing I saw this! I have a project similar to this. I do hope you can give me tips and some insights, I really am struggling and already sent to your gmail, Sir. Hope you can help me. Thank you.
this isn't really multitasking and we should stop calling it that. it's more like manual scheduling. which is like one of the worst (if not the actual worst) things about arduino programming.
Multitasking is the ability of a system to execute more than one task in a fashion that is seemingly simultaneous over a certain period of time, and a "Scheduler" plays a crucial part in multitasking. - so when you say that this is just basically scheduling of tasks, you are correct. And this multitasking in Arduino.
@@joedgoh Multitasking has a pretty specific definition in computing. The "tasks" are processes and have contexts associated with them. To actually multitask, you switch contexts. There's no context switching going on here. This is a problem with the Arduino model. You tell people you're mutitasking but you're really not. I understand trying to dumb things down for the audience but there should be a practical limit for how far down you go.
Hi @GoatZilla, this is not to argue with you. But to clarify things, Arduino UNO R3 is not similar to your desktop computer or a smartphone. Arduino uses a very simple processor with "no operating system", so it has no way to load and run multiple programs. Although it can only run one program at a time, that doesn't mean we can't manage multiple tasks. We only need to change how we do things. Because there isn't an operating system to help us, we have to do things ourselves. And that is how we do multitasking in Arduino. Yes it is simple, but with this simple concept, our processor is able to handle several separate tasks while staying responsive. If you don't want to call it multitasking because of the "technicality" of how it was defined in your computer science class in the context of operating system, that's okay. Thank you for your valuable insights.
@@joedgoh Thank you for your reply, Its my fault I got mistake in typing the code. I did your correction but another error come out (Compilation error: expected ')' before ';' token)
Man, You were born to teach people, the way You explain is Brilliant! Thank You and please keep doing such amazing videos. God bless You! Respect from Russia.
Thank you very much! Really appreciate your comment.
I don't know how to appreciate you right now only i can say.. thank you so much..❤️🤝🏻
Well Done!!!This is one of the few videos that start by showing the viewer what is the purpose and will be achieved. WELL DONE!!! It is structured as it should be
Thank you very much! 😀
This video is perfectly explained thank you so much! Im currently in a Robot building event and this is going to save me.
Thank you and good luck! Please check my other video lesson on millis.
ruclips.net/video/zq6tkXCn-j4/видео.html
This is the kind of explanation I've been looking for for a long time. I'm not even joking, you really did explain the millis function well, cuz I've been struggling with my final year project. But now I realized it was all in the delays. Thank you so much. You've made a new subscriber.
Thank you! Glad to be of help 😊
Your Tutorial So Clear , Great Explained, Thank you sir ! Respect from Indonesia
Thank you! 💚
Thank you, I've been trying to use for loops simultaneously without using delay and you saved me.
You are welcome
Respect from india 🇮🇳🇵🇭
crystal clear you're talented at explaining stuff. Well done mate!
Thank you!
I love you, I have been searching for this for almost 4 hours
Thanks man! Glad to be of help
InstaBlaster...
well done sir, excellent video.......thanks for uploading
An excellently produced and very clearly explained tutorial. Many thanks. I have subscribed.
Really appreciate it 😁 thank you!!
You saved me from many headaches down the road I thank you. I kinda wished I would of got to watch this video before starting my program awww we learning… thank you
Glad to be of help 😁
Thank you Jeod, I have a clear understanding of this topic. Very interesting.
Thank you!
Great video! Will be watching many more. Excellent presentation!
Thank you! Glad you liked it 😊
Your presentation is very Nice, Easy to understand. good Job you done. Thank You.
Thank you so much 🙂
a very elegant way of teaching, like being born to be so. The explanations exceed your reputation, man you live up to your name. huge: LIKE AND SUB. I will be your follower. thank you for your effort
Thank you! I appreciate your comment 🙂
Thanks sir you are genius and continue this type video ❤️ I am Indian and love your content
Thanks for the support
Best Arduino multitasking vid ever. Super helpful. Thank you!
Thank you! Pls. Share 🙂
Ang galing mag turo, thanks.
Thank you!
Excelente tutorial. Parabéns!!!
Man, You are good from Australia.
Thank you. Glad you liked it 🙂
Love it! Exactly what I need it to know. Thanks
Happy to know!
Thanks
man your video saved my life . Thanks for the great video.
Thanks! Please check my other playlist, it might help you too
Nice explaination
Thanks.
You are a great teacher
Thank you!!
really great ,thanks for the this video
Thank you!!
Many thanks 🥰🥰🥰🥰
like the way you, explain and your voice tone
Can you make a tutorial also about the "Control Structures".. which includes if
if...else
for
switch case
while
do... while
break
continue
return
goto
good day sir
what about when the push button is pressed and the seven segment will not reset and it will continue to run how to code it?
thanks
Very nice tutorial
Thanks!
Great Video 🙂
Hello sir "Maraming salamat" for this video😊
Maraming salamat din!
@@joedgoh Sir do you have any facebook site for me to visit?
Sorry, wala pa po. Just this.
Great lesson!!!
Thanks
Galing, salamat
Salamat!
I was able to figure it out, thanks
Great video how would I be able to use millis() for an ultrasonic sensor and 2 servo motors? I'm trying to make an obstacle-avoiding robot.
Love you man this was what I was looking for
Thanks!
I want to write a code as below and I want to replace delay() function with millis().
Please can you tell me how to write code for this?
"
digitalWrite(column[0], LOW);
delay(40); //wait for 40ms before start below statement
digitalWrite(column[1], LOW);
delay(40);
digitalWrite(column[2], LOW);
delay(40);
digitalWrite(column[3], LOW);
delay(40);
"
Thanks, was looking for this.
Welcome! Thanks
Hi I am not able to turn the display on... do u have a circuit diagram or osmething ...plz let me know
GREAT👍 helped me
That a great video
Thank you!
Hi, I enjoyed your video on using Millis(), I would like to know if you have or will have a video on State Machines using Arduino. Thank you for any help you may be able to provide.
Hi, thanks for watching. Sorry but I don't have a video on state machine. I hope my other videos on this playlist can help you with your needs.
Hi Joed. Could you do the same activity using interrupts?
Hello
when arduino receive angle (number) from Serail for exemple , the stepper motor dont finish distance to go (stop ) because Serial receive next angle . What should I do for arduino receive and let stepper motor finish distance Simultaneously ?
little bit confused. why "d" hasn't been declare in no one of part of sketch in first example (7segment display counter)? it already been in the "for" loop. and it's it.
How to stop the Millis function form looping ? I'm new to Programming , please help sir.
Sir, takbuhan ko talaga vids mo pag may project ako 😭😂
Glad to be of help Chimmie ❤
Thanks!
Thank you very much! ❤️
I'm working on the challenge and I'm having problems on the seven segment display, counting backwards I was able to count from 9 to 0 but when it gets to 0 it does not restart, if I I press the switch it will reset to 9, but when it gets to 0 again same problem. Will it be possible if you post the solutions. Thank you.
Great work
Thank you!
good very informative
Thank you!
hi
can you plese make it with steeper , i try it but it dose not work . thanx
U are a legend
Thank you very much
how do you make the servo arm return slowly as well?
This is very informative :) Thanks
Thanks :)
Very good.....can you add my reference... thank you.,,
Thanks!
hello
Is there a way with the millis() for the LED tourn ON OFF only 5 ones?
I am sorry, can you rephrase the question? What do you mean by 5 ones?
@@joedgoh millis() infinite loop . i want led turn on off by millis() but just 5 iteration ?
You just have to create a variable that counts from 1 to 5 (increment by one every blink using the millis). Then you can add a condition that your blink code should only be performed while/if the counter
it seems very useful, but it's a bit confusing for me. Sir, I wonder if I can use it with 2 codes if there is an ''if'' and ''else" statement, for example, I have combined ultrasonic sensor and water level sensor but the program seems can't run properly. Can you help me, sir
It is normal to be confused when you first use this concept. It is okay to use if...else code block. You just have to understand when to properly use it. Using if...else.., only one of these code blocks gets executed at one time. But when you use, if.....if...if..., all conditions could be satisfied and be executed at one time.
@@joedgoh can you check my code
Any car Crank and cam signal how to make code explain please
good
gut gemacht !!!
Thank you!
Thumbs up
Thanks!
would like a lesson about array and 2d array if you have time.
Thanks. examples using 2D array with crystal LCD BIG FONTS for Clock. I am just a newbie to Arduino.
Contact me: joedgoh@gmail.com and send me your specific questions. Thanks!
How to make car Crank and cam sensor signal timerone use explain please
Professor, I have a request, sir 🙏, there are a lot of tutorials about atmega, Arduino and ESP8266 but *what about AT89s52 [8051 families]??* the AT89s52 is a very basic microcontroller that we read in our college,
and my problem is "I'm making a digital clock [7-segment] using AT89s52 (NO RTC) but the time drifts about 5.6 seconds in every hour!! and this At89s52 microcontroller doesn't have any function like millis() inside AT89s52's IDE(Microvision Keil software), and a book suggests to play with the ppm and fix the error.But, yet the problem is At89s52 is not like Arduino , so Professor, I need your help, can u please make a dedicated video on this?? so that everyone will learn a lot, or u can also help me by writing about the solution below 🙏"
BTW I'm using a 16MHz crystal with this microcontroller and using timer_0 to generate a 25ms delay and using interrupt_1 to count that 40times so that there will be 1 second completed, but that's not the problem I guess.. I just need your help.. .🙏🙏
Thanks, Love it.
Thanks Dean!
@@joedgoh brother please make a video on how to make gps using Arduino
Thank you Deepak. Eventually I will, when I reach topics on IoT
I use the library called "elapsed millis"
You have online course
actually there is a limitation. When your code gets long enough, and you have to keep the timing precise, this method does not work. As you can see that he used >= instead of ==, this is because as the loop goes on, it will skip a few count, so the longer it runs, the more errors it accumulates. It does not take long to get a 1000x of millis error and your system's diff becomes apparent.
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..???.
thank you sir btw my i ask are you a Filipino or asian !
Yes both. Filipino
Greetings from Denmark. Thank you for the very interesting video. I was successful with the 1st & 2nd elements - lighting 4&5 and lighting 1to9 with delay . I was not successful with millis! I would be greatly grateful if you could spot an error in my sketch. Note my 7-segment only shows 0 and the switch has no effect. Thank you
#include
Servo servo1;
int digits [10] [7] = { { 1, 1, 1, 1, 1, 1, 0}, //digit 0 //note 3 curly brackets
{ 0, 1, 1, 0, 0, 0, 0}, //digit 1 // note 2 curly brackets
{ 1, 1, 0, 1, 1, 0, 1}, //digit 2 // note 2 curly brackets
{ 1, 1, 1, 1, 0, 0, 1}, //digit 3 // note 2 curly brackets
{ 0, 1, 1, 0, 0, 1, 1}, //digit 4 // note 2 curly brackets
{ 1, 0, 1, 1, 0, 1, 1}, //digit 5 // note 2 curly brackets
{ 1, 0, 1, 1, 1, 1, 1}, //digit 6 // note 2 curly brackets
{ 1, 1, 1, 0, 0, 0, 0}, //digit 7 // note 2 curly brackets
{ 1, 1, 1, 1, 1, 1, 1}, //digit 8 // note 2 curly brackets
{ 1, 1, 1, 0, 0, 1, 1}, //digit 9 // note 2 curly brackets
} ; //note: semi-colon!
int d = 0;
unsigned long startTime_display = 0;
unsigned long interval_display = 1000;
int servo_angle = 0;
unsigned long startTime_servo = 0;
unsigned long interval_servo = 20;
void setup () {
for (int i = 13; i >= 7; i--)
pinMode (i, OUTPUT);
pinMode (2, INPUT); //button on pin 2
Serial.begin (9600);
servo1.attach (6); //servo pin 6
}
void loop () {
unsigned currentTime = millis();
Serial.println (currentTime);
if (currentTime - startTime_display >= interval_display) {
startTime_display = currentTime;
for (int i = 13; i >= 7; i--)
digitalWrite (i, digits[d] [13 - i ] );
d++;
}
if (digitalRead(2) == LOW || d == 10) d = 0; //reset d to 0
if (currentTime - startTime_servo >= interval_servo) {
startTime_servo = currentTime;
servo1.write(servo_angle);
servo_angle++;
if (servo_angle == 180) servo_angle = 0;
}
}
Hey can u help me for multitasking of our project
I might be able to answer some of your questions, but not really help you in your project.
*Q- Make Arduino millis() equivalent function for 8051 microcontroller*
Who can write this c code??
Hint -- Tms/(Fclock*1000)
Wow, Please help me with my problem with delay in my code
digitalWrite(relay1, LOW);// turn relay 1 OFF
digitalWrite(relay2, HIGH);// turn
Serial.println("M1-CW");
delay(12000);
digitalWrite(relay1, HIGH);// turn relay 1 OFF
digitalWrite(relay2, HIGH);// turn
Serial.println("M1-Stopped");
delay(random(3000,5000));
digitalWrite(relay1, HIGH);// turn relay 1 OFF
digitalWrite(relay2, LOW);// turn relay 2 ON
Serial.println("M1-CCW");
delay(12000);
digitalWrite(relay1, HIGH);// turn relay 1 OFF
digitalWrite(relay2, HIGH);// turn
Serial.println("M1-Stopped");
delay(random(3000,5000));
hindi na ba uso ang ISA card sir? 🤣
Those were the days - life is simple 🤣🤣
can you make this vdo in Hindi ? please sir
Good Thing I saw this! I have a project similar to this. I do hope you can give me tips and some insights, I really am struggling and already sent to your gmail, Sir. Hope you can help me. Thank you.
I"ll look into this. Thanks
@@joedgoh Your way of teaching should be done nowadays. Makes learning fun and exciting. I pray more professors such as you. God Bless Sir. Respect++
this isn't really multitasking and we should stop calling it that. it's more like manual scheduling. which is like one of the worst (if not the actual worst) things about arduino programming.
Multitasking is the ability of a system to execute more than one task in a fashion that is seemingly simultaneous over a certain period of time, and a "Scheduler" plays a crucial part in multitasking. - so when you say that this is just basically scheduling of tasks, you are correct. And this multitasking in Arduino.
@@joedgoh Multitasking has a pretty specific definition in computing. The "tasks" are processes and have contexts associated with them. To actually multitask, you switch contexts.
There's no context switching going on here.
This is a problem with the Arduino model. You tell people you're mutitasking but you're really not.
I understand trying to dumb things down for the audience but there should be a practical limit for how far down you go.
Hi @GoatZilla, this is not to argue with you. But to clarify things, Arduino UNO R3 is not similar to your desktop computer or a smartphone. Arduino uses a very simple processor with "no operating system", so it has no way to load and run multiple programs. Although it can only run one program at a time, that doesn't mean we can't manage multiple tasks. We only need to change how we do things. Because there isn't an operating system to help us, we have to do things ourselves. And that is how we do multitasking in Arduino. Yes it is simple, but with this simple concept, our processor is able to handle several separate tasks while staying responsive.
If you don't want to call it multitasking because of the "technicality" of how it was defined in your computer science class in the context of operating system, that's okay. Thank you for your valuable insights.
i am using millis to control 2 addressable rgb strips but it seems to not work properly could you check out the code
#include
#define NUM_LEDS 20
#define LED_PIN1 2
#define LED_PIN2 4
#define COLOR_ORDER GRB
#define CHIPSET SK6812
#define BRIGHTNESS 20
#define VOLTS 5
#define MAX_AMPS 500
CRGB leds1[NUM_LEDS];
CRGB leds2[NUM_LEDS];
unsigned long startTime_display = 0;
unsigned long startTime_display2 = 0;
unsigned long interval_display = 2000;
unsigned long interval_display2 = 500;
int j = 0;
int i = 0;
void setup() {
Serial.begin(9600);
FastLED.addLeds(leds1,NUM_LEDS);
FastLED.addLeds(leds2,NUM_LEDS);
FastLED.setMaxPowerInVoltsAndMilliamps(VOLTS,MAX_AMPS);
FastLED.setBrightness(BRIGHTNESS);
FastLED.clear();
FastLED.show();
}
void loop() {
unsigned long currentTime = millis();
Serial.println(currentTime);
if(currentTime - startTime_display >= interval_display){
startTime_display = currentTime;
for(i=0; i= interval_display2){
startTime_display2 = currentTime;
for(j=0; j
I type the code and review many times, say 62 times but still this annoying error display; Compilation error: 'startTime_display' was not declared in this scope, what's wrong, CODE: #include
Servo servo1;
//a,b,c,d,e,f,g
int digits[10][7] = {{1,1,1,1,1,1,0}, //digit 0
{0,1,1,0,0,0,0}, //digit 1
{1,1,0,1,1,0,1}, //digit 2
{1,1,1,1,0,0,1}, //digit 3
{0,1,1,0,0,1,1}, //digit 4
{1,0,1,1,0,1,1}, //digit 5
{1,0,1,1,1,1,1}, //digit 6
{1,1,1,0,0,0,0}, //digit 7
{1,1,1,1,1,1,1}, //digit 8
{1,1,1,1,0,1,1}, //digit 9
};
int d=0;
int servo_angle = 0;
unsigned long starTime_display = 0;
unsigned long starTime_servo = 0;
unsigned long interval_display = 1000;
unsigned long interval_servo = 20;
void setup() {
// put your setup code here, to run once:
for(int i = 13; i>=7; i--)
pinMode(i, OUTPUT);
pinMode(2, INPUT);
Serial.begin(9600);
servo1.attach(9);
}
void loop() {
unsigned currentTime = millis();
Serial.println(currentTime);
if (currentTime - startTime_display>= interval_display) {
startTime_display = currentTime;
for(int i=13; i>=7; i--)
digitalWrite(i, digits[d][13-i];
d++;
}
if(digitalRead(2) == LOW || d == 10) d=0; //reset d to 0
if(currentTime - startTime_servo >= interval_servo)(
startTime_servo = currentTime;
servo1.write(servo_angle);
servo_angle++;
if(servo_angle == 180) servo_angle = 0;
}
Hi. Your declaration is wrong. You typed star instead of start, as in starTime_display instead of startTime_display.
@@joedgoh Thank you for your reply, Its my fault I got mistake in typing the code. I did your correction but another error come out (Compilation error: expected ')' before ';' token)
Sir please send the challenges code please
Thanks
Thank you very much!! :)