Multi-tasking, Multithreading, or Hyperthreading with Arduino

preview_player
Показать описание
Technically you cannot multithread with a single Arduino microcontroller. However, we can simulate multithreading.
Рекомендации по теме
Комментарии
Автор

Great tips. One thing to keep in mind is that if you stay in a while loop, the particular code you wrote will not allow the LED to continue blinking.

micahnightwolf
Автор

SERIOUSLY THIS IS AMAZING! I was dying trying to figure out multitasking on my tft computer i'm making, and this worked perfectly! I also didn't know you could read microseconds so that was helpful to!

nicepotato
Автор

This looks like the code I’ve been looking for to run 3 stepper motors simultaneously or at least as near to simultaneous as possible. Thank you!

JoeBowler
Автор

Thank you for THIS! Have been sharing this video when people ask me about Millis.. Also you have a good programming sense..

sharath_naik
Автор

Great video sir! Thanks a lot! Those time/lasttime/elapsedtime is just what I needed. Also I didn’t know about different functions one can make and call upon.

P.s. I’ve heard that you’re planning to make a new video about this in the future. Maybe for next time, do some practice calculations to see how that system of keeping track of time works. (Why do we need to code these calculations like we do, what does it do after a few cycles/loops. Why does this little ‘keeping time’ system work so good..) I’m sure many people (like me) are quickly confused when dealing with these calculations. But for the rest, great video. It was very helpful!

Jobobaboss
Автор

I think there's still one little issue with this example. If you keep pressed the button the program will stall on the while(buttonPressed) loop, thus the led won´t blink until button is released. Perhaps adding the logic to avoid that would be great!

danielvalganonmedecigo
Автор

I think nowadays it's easier to use freerts tasks, because in case you have 2 cores (like in esp32) you can even have 2 tasks running at the same time. This solution is nice, but it's really hard to manage once you have several different things going on.

werneckpaiva
Автор

Really helpful. Thank you so much. Subscribed. Cheers J

joshuadelisle
Автор

I was using it to read button input too. Thank you!

digitalminister
Автор

Hello sir, good evening,
Am creating a program 20Khz PWM signal for pump. It's absolutely working fine, when I wrote 2nd millis function and upload same board but 2nd program is not properly worked. Any solution for this sir ? Am using Arduino UNO board.

akash
Автор

so how to write something after 'hello'? so 1 press 'hello' 2nd press 'world' then back to 'hello'

AussieTrucking
Автор

Why not the short int button = 8? Yours is much longer

brandonbarr
Автор

what if the two tasks are dependent to each other? at that time how to handle to events simultaneously

pruthvijagadeesh
Автор

How would you program button that create 8 or so binary code. For example 1 push. 0001. 2 push 0011 e.t.c?

Khujandiho
Автор

Heya.. im facing a little problem with the pid line follower...im using a diy ir sensor array of 6 the pid is working great and the library is kinda working but when i look at the values it kinda returns weird values sometimes which throws off the pid algorithm...do you think qtr library cant be used with dir sensor array?

capistor
Автор

shouldn't you use unsigned long ?

PerchEagle
Автор

In the end you used all 3 of them in the title XD

jhunmichaelibanez
Автор

thank you for the video, please help me i want to creat in incubator but the lcd result work with delay of servo motor not with theme delay exmp : dht11 delay (10), and servo (500), the lcd show result of dht11 with delay (500)

djaminepira
Автор

'Anytime more than 16ms, you should then use millis();'

waeem
Автор

Bro its not multithreading..i can say multitask using time base...any way explanation is nice good work...but change heading 😎

jokerjoker-tpvf