Questions tagged [millis]
Is a standard library function. It returns the number of milliseconds since the Arduino board began running the current program.
179 questions
-1
votes
1
answer
79
views
Pop-Up Headlight Management
I have a 90s car with pop-up headlights but I don't have the original headlight module. So I am trying to make one myself.
The idea is simple
1- I have a Master switch that keeps headlights UP ...
0
votes
2
answers
118
views
Difference Between delay() and a while Loop with millis() in Arduino?
What are the practical differences between using delay() versus a while loop with millis() for timing in Arduino projects? I assumed both methods are blocking, but I'm not completely sure.
Example ...
0
votes
1
answer
196
views
I am using millis () function but after one iteration it does not check the condition and enters the loop. What should I do?
I am using mq7 sensor where I have to toggle vcc between 5 to 1.5 V for 1 min and 1.5 min. For this I am using millis function.But after 1st iteration it skips the condition and enters the loop.
The ...
1
vote
1
answer
147
views
Fixing a pedestrian traffic light sequence pattern in a cycle using millis and without delay
I was emulating the pedestrian traffic light cyclic pattern (red, green, green flashing) in the next Arduino code. But when I run this code with my ESP8266 Wemos D1 mini controller, it appears the ...
1
vote
2
answers
506
views
Working with pulseIn() and millis()
I'm trying to use pulseIn with elapsed time using millis(), I don't want to use interrupts instead of pulseIn (I need pulseIn because I need accurate pulse time), the elapsed time doesn't need to be ...
1
vote
2
answers
1k
views
Stepper motor micros (millis) non-blocking delay simple example?
I am trying to get a simple non-blocking replacement for:
digitalWrite(stepPinX, HIGH);
delayMicroseconds(500);
digitalWrite(stepPinX, LOW);
delayMicroseconds(500);
This is what I tried, and the ...
0
votes
2
answers
4k
views
The same button with one click and double click [closed]
i hope to get some help with my code.
I am trying to distinguish between a single press and a quick double press of the button with debouncing.
I am making some silly mistake in my code and i can't ...
0
votes
1
answer
199
views
Using Millis instead of delay to reboot relay
I want to reboot relay (turn off , waiting 4 seconds and turn ON)
it works perfectly if I use delay(4000), but code is blocked while delay (4 seconds) and I cant start relay 2.
How can I use Millis ...
-2
votes
1
answer
313
views
LED blink patterns with multiple LEDs with millis() not using Delay()
I want to make LED blink patterns with multiple LEDs with the millis() function. I researched about it but did not find a perfect solution.
I found one blog, but it is using a LED pin number array; I ...
0
votes
1
answer
772
views
Milliseconds using square wave RTC
i am trying to make a code that prints the time hh:mm:ss:ms using RTC,i have made it using millis() but it is not accurate +/-2 milliseconds
ho can i make it using sq wave and intterupt
here is the ...
0
votes
3
answers
813
views
Using 1 ms delay() in a for loop to check inputs.. Bad?
So first off, I know millis() exists. Just asking out of curiosity. Say you have a button you wanna check for during a delay.. Maybe a 10 second delay. So you make a for loop that checks for input and ...
2
votes
2
answers
1k
views
Toggle button switches through case statements with button debouncing
The overview of my code is that I want a toggle button to be pushed and each button push will move the code to the next case statement. In each case statement, there will be different LED functions. I ...
2
votes
2
answers
116
views
Trying to keep my main code running unless an input is LOW for a certain amount of time
I have code that creates a sequential signal with 4 LEDS. It cascades to the right. This works when I hold down the input button. What I need help with is having the code run exactly the same when ...
0
votes
1
answer
408
views
Question about using millis for alarm conditions - Arduino
I am new to programming in general and to Arduino as well.
I am working on a small project to improve my ability to write complete and kind of useful programming sketches.
I am facing a problem. I am ...
3
votes
1
answer
1k
views
How do I run 4 LEDs sequentially based off of a push button input?
I am trying to create a program that runs 4 LEDs sequentially while also being able to do other things with different inputs and outputs. Because of this, I am using the millis function and not the ...