All Questions
25 questions
2
votes
2
answers
4k
views
Arduino Reset via Software (every day)
Dear Stack Exchanger's,
I want to reset my Arduino and system in every 24h for preventing frozen software and also other connectivity stuffs.
I wrote a program which connects a digital pin to reset ...
1
vote
2
answers
441
views
run a function for a certain amount of time! [duplicate]
i'm working on a project where i need to run a function for 20 minutes and the function writes to memory using EEPROM every minute. How can i make the function run for 20 minutes, i was thinking of ...
1
vote
1
answer
283
views
Issue with simple timer based on millis()
Sorry to bother but I am at my wits end. I'm experimenting with timers, and starting very simple. The following code is supposed to print the content of a variable each time an interval of time has ...
1
vote
2
answers
290
views
Switch on the piezo emitter for a short time
I need a short beep for every minute of change. I wrote a separate function. The signal duration should be 50 ms, the rest of the time the emitter connected to the A1 contact should be silent.
A ...
1
vote
2
answers
3k
views
How to keep track of millis during sleep mode
In my application, I need to keep track of the time the application has been running as well as use sleep modes. However, when using the sleep modes, Timer0 is disabled, and therefore millis stop ...
2
votes
1
answer
309
views
Can't use millis() instead of delay
I am making a home coming/leaving light for car. First I want that whenever I press the car key lock, a timer will start for 10 seconds. And if I press a button twice within 10 seconds, pin 13 will ...
1
vote
1
answer
174
views
Arduino Timer0 Piggyback
As described here
https://learn.adafruit.com/multi-tasking-the-arduino-part-2/timers
I use timer 0 to get my own timer with a milliseconds resolution.
It is setup like this:
void setup (void)
{
...
2
votes
0
answers
535
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.
...
0
votes
1
answer
747
views
Function Millis() Arduino
I would like to make a countdown with arduino.
To do this I'm using the millis () function, but I have a problem, I can not reset this.
Reading on the internet I read that it is not possible to do ...
1
vote
2
answers
2k
views
Issue in long ON OFF timer using millis()
I have 3 components: a relay and two LEDs...I want two timers using Arduino... In timer one, relay should be off on; one LED is off; and other is on...In second timer, relay is off; one led is on; ...
1
vote
1
answer
2k
views
uno timer0 prescale
I have a project where I need to get a low frequency to get a pwm suited from my project. The problem is that after I modify the frequency of timer0 the millis() becomes slower or faster depending on ...
0
votes
3
answers
707
views
Why doesn't millis() use 1 µsec or 1 msec interrupt?
Arduino millis() does not make use of one millisecond interrupt. Instead they make use of 1,024 µsec interrupts and manipulate. Any specific reason why this was implemented this way?
In one case, we ...
2
votes
1
answer
11k
views
Button with switch timer and reset time function + LED feedback. What am I doing wrong?
Beginner here.
I´ve been trying to implement a button function timer working with millis() instead of delay as I want the button to be responsive while the timer is running.
So far I´ve managed to ...
4
votes
4
answers
11k
views
Use timer0 without affecting millis() and micros()
I'm writing a library which needs an ISR to turn off an LED some time after it was turned on. Since it's all about turning an LED on and off it doesn't need to be very precise. On the other hand I ...
0
votes
1
answer
700
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 ...
1
vote
1
answer
351
views
Calculating with millis()
The following code works fine until I turn the if (tijd - action >= 500) into if (tijd - action >= 1000)
I wonder why this fails.
If I just loop and print the tijd - action it has no problem ...
0
votes
2
answers
844
views
Press on pressure sensor once, turn on LED for 6 seconds
I am working on a project where I would like to press on a pressure sensor (0-1024) once and turn on the LED and turn off by itself after 6 seconds. I am quite new to arduino and I can't seem to ...
0
votes
3
answers
2k
views
Time.h rollover after 49.7 days [duplicate]
I'm developing a arduino based system, which includes a alarm system.
Searching on the Internet, I found these lybraries "Time.h" and "TimeAlarms.h".
In the requirements, it says: "Time does not ...
0
votes
2
answers
234
views
Sketch does not work without delay() or other complex functions like digitalWrite()
I have a simple sketch here that should just blink a led once a second or so (approximately):
boolean onOff=true;
int count=0;
void setup() {
pinMode(13, OUTPUT);
}
void loop() {
count++;
...
1
vote
1
answer
173
views
How come my code does not wait for a specific time before going into an if statement?
I have an HC-SR04 attached to a servo. When the 90 degree reading is less than 30 cm, I want the motor to take 2 seconds to turn to 130 degrees, get a measurement on the right, and turn back to 90 ...
14
votes
4
answers
54k
views
Using millis() and micros() inside an interrupt routine
The documentation for attachInterrupt() says:
... millis() relies on interrupts to count, so it will never increment inside an ISR. Since delay() requires interrupts to work, it will not work if ...
1
vote
3
answers
1k
views
Managing timer intervals using millis at random intervals
I am doing a project which needs to meet the following specifications.
On receiving an SMS arduino will start switching 1st relay on after some
time duration(say 30 Seconds) relay 1 will be ...
7
votes
4
answers
2k
views
Adjust time calculation after Timer0 frequency change
I have an Arduino Nano with an 328P and need all 6 PWM pins.
Thus, I had to adjust the prescaler and WGM Mode of Timer0.
It is now in phase correct PWM mode with a prescaler of 1.
TCCR0A = _BV(...
6
votes
3
answers
6k
views
Visual clock with millisecond display refresh rate
I need to create a millisecond capable visual clock - I will use the clock for visual frame synchronization of multiple cameras. I found this project but it seems to use a LED display that only has ...
9
votes
2
answers
4k
views
Does millis() conflict with the PWM pins associated with timer 0?
I've read that the millis() function uses the same timer as a couple of PWM pins.
If you're using those PWM pins, will millis() still return the correct value?