Questions tagged [millis]

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

16 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
3
votes
0answers
100 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
348 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
1answer
60 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
33 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
145 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 ...
1
vote
1answer
76 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
44 views

Atmega Millis with Quartz crystal

I followed https://www.arduino.cc/en/Tutorial/ArduinoToBreadboard this tutorial to program my Atmega 328p to run on a breadboard with a 16 MHZ Quarz crystal and two 22pF capacitor. I want to program a ...
1
vote
1answer
66 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
313 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 ...
1
vote
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: ...
0
votes
0answers
52 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
1answer
236 views

Stepper motor based clock movement with DS3231

I am working on a clock movement that is powered using a stepper motor and the GSM2 driver board. The delay between steps needed to achieve 1 rpm on the second hand works out to 25 ms. In my current ...
0
votes
1answer
182 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 ...
-1
votes
1answer
428 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 (...
-1
votes
1answer
206 views

Using mills() in place of delay() on relays not getting solid switch over

I know I should post some code that maybe cleaner but really I am just in need of a answer to a problem I seem to run into a lot when using mills() in place of delay(), whilst making a Christmas light ...