millis vs. delay Part 4 | A mini-series on Timing Events with Arduino Code

millis vs. delay Part 4 | A mini-series on Timing Events with Arduino Code

40,028 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@alexandrefernandes7186
@alexandrefernandes7186 - 04.04.2019 14:04

Ótimo

Ответить
@etiennegrix1738
@etiennegrix1738 - 04.04.2019 14:49

Ours of internet searches explained quickly,thank you looking forward to the next sessions!!!!!!

Ответить
@VasilisKarastergios
@VasilisKarastergios - 04.04.2019 14:58

Very well explained as usual, I hope you introduce some state machine examples using the millis function.
Thanks for sharing 👍.

Ответить
@erboy5546
@erboy5546 - 05.04.2019 14:40

A very good explanation. I know the millis function, but there is still place to learn something new.
It's obvious that you put great effort into the interpretation.
I`m looking forward for more videos to come. Big thanks for sharing

Ответить
@UpcycleElectronics
@UpcycleElectronics - 05.04.2019 18:12

I just caught up on this series, thanks.
I'm still a bit foggy about how to execute my project that incorporates 3 button states (single/double press and button held) with software button debouncing and a LCD menu (also part of a sensor + I/O system running in the background//so no delay). I'm trying to avoid using multiple buttons in favor of a rotary encoder with built in button. I want to do something like:
button pressed = select option
double pressed = last menu layer
held = return to home/top menu layer

I can't seem to get it working well especially with the debounce code. It just becomes a convoluted mess. I feel like there should be a much more elegant solution. Perhaps one might incorporate either the use of external interrupts or the other onboard timers + interrupts on the 328 in order to achieve these goals?
I wish I could figure out or find a way to use millis like delay. I want some kind of simple function that creates a new instance of the flags and timers needed for an effective delay without using delay();.
...anyways... that's just my block headed conundrum....
Thanks for the upload :-)
-Jake

Ответить
@AliHussein-bb3ie
@AliHussein-bb3ie - 14.04.2019 09:40

That's was awesome😲

Ответить
@TheGremlinsParadise
@TheGremlinsParadise - 07.10.2019 07:09

You can use delay while executing 2 or more events.
You simply place each event in a separate function and call upon it in the loop.
NOTE: though this is not really great for big and complicated programs, or
functions that interrupt each other. Otherwise you can simply do this.

void loop() {
// OPTION 1
If (some thing == some value) doSomething();
if (some other thing == some other value) doSomethingElse();


// OPTION 2
doSomething();
doSomethingElse();
}

void doSomething() {
// OPTION 1
ENTER YOUR CODE HERE

// OPTION 2
If (some thing == some value) {
} else {}
}

Same thing counts for the doSomethingElse(); function.
As long you dont put RETURN in the loop, where you call
the events, they will work just fine, even without millis().

But it could be useful for people to use if you do not
want to touch the millis() function at all.

Ответить
@elzjonz
@elzjonz - 27.05.2020 17:53

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

Ответить
@mbrad2669
@mbrad2669 - 13.02.2021 01:10

The explanations along with the animations REALLY drive the coding home, exactly how I need things explained to me as a visual learner- awesome

Ответить
@gauravsharma3829
@gauravsharma3829 - 09.03.2021 20:00

Thank you. You explained the topic so well! This video helped to understand the concept and helped to solve my issue. Thanks again

Ответить
@qzorn4440
@qzorn4440 - 18.05.2021 02:31

i love this stuff , now i won't have to buy an arduino for the arm, one for the eyes, one for the foot, one for taking haaa, you get the idea! thanks a lot, nice info....:)

Ответить
@hackalandy
@hackalandy - 01.06.2021 13:01

These are the best programming tutorials. Very clear and straight to the point!
I would like to watch the next lesson on millis() in this series. What is it called?

Ответить
@paragtomer9263
@paragtomer9263 - 05.01.2022 13:26

I want to do something every 24hr and then one another thing how do i do it

Ответить
@kitkirkyen2002
@kitkirkyen2002 - 19.01.2022 05:39

Thank you so much for this very clear explanation sir. Where is the link for the continuation of this video sir?s

Ответить
@lawfullysuspicious1225
@lawfullysuspicious1225 - 08.03.2022 15:27

A chest button to activate a 3rd eye....oh my do you know code to fit a prothsetic head...........

Ответить
@tawfeekbizri5524
@tawfeekbizri5524 - 16.08.2022 02:36

Thanks alot for your explanation!
Also, do you have a video explanation about pwm?

Ответить
@ezeoluchukwu5104
@ezeoluchukwu5104 - 24.05.2023 15:18

This is indeed good tutorial.
Keep the good work going friend.
Please can you show me the link for EEPROM Tutorial pls.

Ответить
@user-tk6ud6fu1i
@user-tk6ud6fu1i - 22.08.2023 05:15

You explained my exact situation with a switch with multiple events at different times after the switch is pressed. You mentioned you would have a 5th lesson with coding examples. I can't find that lesson is it still available?

Ответить
@pixies4ever324
@pixies4ever324 - 07.01.2024 02:17

great video. i'm actually excited to watch the next one in this series. i needed to learn about the millis() function and your vid series is totally helping me.

Ответить
@emmanuelmtegha3361
@emmanuelmtegha3361 - 02.02.2024 17:59

Thank you

Ответить
@hago-jn6md
@hago-jn6md - 16.02.2024 19:56

Very comprehensiv tutorials! But where is "millis vs. delay Part 5" ?

Ответить
@VidarrKerr
@VidarrKerr - 31.03.2024 18:10

This made no sense. You had a good thing going with the eyes and then the servo arm and then you just switched it all up to eyes and a button and another light. Why? The eyes and the waving arm was a perfect example to work with. This just got mixed up.

Ответить
@cadillacescalade5428
@cadillacescalade5428 - 12.04.2024 07:06

Hi Question? I'm doing a sketch that has a servo and a DFPlayer Mini the way the sketch is written when I cover the IR sensor it sometimes works an then sometimes not working.

Ответить