Questions tagged [millis]

Is a standard library function. It returns the number of milliseconds since the Arduino board began running the current program.

17 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
3
votes
0answers
76 views

Help with millis to get accurate timing

I'm essentially trying to create a music box which is light activated using an LDR. When it's open a song plays, while a servo rotates a figurine back and forth, and an LED dims and illuminates in ...
2
votes
0answers
320 views

Millis() is Not Working

I have a sketch that uses two timers using millis() from a library I created to keep time. The timers seem to be working correctly, but when I print the start time of each timer, it is clearly wrong. ...
2
votes
0answers
104 views

Start LED blink at certain millis() value

I was looking at the blink without delay sketch and I was trying to modify it so the LED would start blinking after 1000 ms. I changed the previousMillis variable to 1000, but the program didn't ...
1
vote
0answers
74 views

Arduino interface of push button and led using millis()

I am working on a project of blinking of led using push button without delay().The limitations of led blinking is in accordance with the no of times the push button is pressed the led should blink ...
1
vote
1answer
44 views

Timing push button code

I am trying to time how long button is held for. The code seems to work but with two problems: the millis values are being read wrongly. If you hold the button for 1 second, it returns holdTime of ...
1
vote
0answers
28 views

how to control 2 sensor and 3 relay with fuzzy

i'm using fuzzy to decide how long the relay on pump on and i got some trouble for it he just looping on relay how should i do thats my code //---------Fuzzy 2.1 prelauch---------- //-----iNPUT ...
1
vote
0answers
102 views

Change delay function to millis function to play music

I'd like to write a code by changing the delay function in the music playing code to the millis function, do you know how? #include "pitches.h" // notes in the melody: int melody[] = { ...
1
vote
1answer
56 views

3 input (on/off/off with delay) to control 1device using ESP8266 as Web Server

I want to control one device in three ways : turn on / turn off / turn off with delay. To do that i use an ESP8266 web server + android phone app. The problem is that turn off with delay wont work. It ...
1
vote
1answer
61 views

I need to change this code to start the section of code when the switch is on and not when the switch is released

I have this section of code. It works fine and how I want it only, it executes when the button is released not when it is pressed. My application needs to execute this code when a switch is on. The ...
1
vote
0answers
272 views

Stepper wait for X seconds in a loop with millis (not delay)

In the code below I would like the stepper to bounce back and forward between two limit switches and while it is doing this it should turn and than wait for e.g. 1 second. I thought I could achieve ...
0
votes
0answers
44 views

How to get delay after millis and stop the relay

thats my flowchart for my code void loop() { //-------------Fungsi Read sensor----------- sensorAll(); hasilec = (ppmcensor - inputec); ph = (phcensor - inputph); // hasilec = random(...
0
votes
0answers
49 views

IR Remote Breathing effect

Hı everyone I am trying give my led a breathing effect using millis() But neither led isnt breathinng and it stucks I cannot use other fucntions. Please help... #include <IRremote.h> #define ...
0
votes
0answers
122 views

Run a dc motor for amount of time without delay

Hi everyone I have a project and I need to run a dc motor for amount of time without using delay I use DelayWithoutBlink technique. In this code the motor should run for 5 second in cw then it will ...
0
votes
1answer
643 views

Countdown sometime stop

I've made a game with 3 countdowns and 1 global countdown. When we start, the global one, go from 45:00 to 00:00. The 1 go from 15:00 to 00:00 and if it reach 00:00: The 2 start and go from 15:00 to ...
0
votes
1answer
70 views

ESP32 millis not working properly

I have a program which measures temperatures every 30 minutes and sends them to a database. Immediately after running the program the first measurement is sent, however, the second (which should be ...
0
votes
1answer
1k views

Help me restructure code for multitasking Neopixel + IR remote + arduino

First of all, I'm completely new to both arduino, and programing. Second, as for a good newbie, i'm trying to build a fairly complicated project. So, any help and suggestion is welcome. The goal is: ...
-1
votes
1answer
423 views

How to use millis instead of delay on Arduino for independent time intervals for two output pins

I wanted to use millis for the code below but stuck in between . can anyone help to change the given code to millis? Code here: void set(){ digitalWrite(on, HIGH); // turn the motor on (...