Questions tagged [timers]
Timers are the hardware in the processor used to count and time events. Use this tag for questions about the hardware timers.
451 questions
1
vote
1
answer
987
views
Having trouble passing data through RF24
I have three RF24, all of them are connected to one arduino-uno each. The first one has sensors that sends data to the second one then the second one passes it to the third one. The first pass from ...
2
votes
8
answers
8k
views
How accurate is arduino time keeping?
I want to use my arduino to turn a light off for 16 hours and on for 8 hours. I know the general code, just using delays and the relay shield code as well. I want to know how accurate this will be? ( ...
1
vote
1
answer
36
views
How can I achieve <50 ppm timing with a Sparkfun Artemis ATP?
I want to sample an ADC at very regular intervals. Right now, using millis/micros (which are driven by the internal RC oscillator), I'm off by around 3000 ppm, and it drifts.
Here are some things that ...
2
votes
2
answers
225
views
How can I read the Timer direction in phase correct PWM?
I have had to use Timer0 with phase correct PWM and a prescaler of 1. This results in a 32khz PWM frequency and obviously impacts millis, delay and micros. (Timer1 and Timer 2 are also in use so ...
-2
votes
1
answer
383
views
Arduino Start en Stop
Is there a way to set a time for instance 8.00 PM to make the arduino-uno start or stop at that time?
1
vote
1
answer
270
views
ADC value changing after changing Timer1 value in program
I'm writing a code where analogRead() reads ADC value from load. After reading ADC value, if it is not in range, I need to manipulate Timer1 value. Which is also getting changed.
But, after changing ...
3
votes
1
answer
156
views
Cons of using timer0 with external input?
I'm working on a project of differential drive control in which I use speed encoders for the odometry.
I count the number of rising edges using counter0 and counter5 (on Arduino Mega 2560), which ...
0
votes
2
answers
104
views
Timer setup interferes with LED blinking logic
This example is a simplified version of what I really need to do, but I think it demonstrates the problem (= my misunderstanding?). I need to use a timer to count microseconds; my code shows how I ...
2
votes
1
answer
6k
views
4 Bit Counter up and down
we are asked to create an Arduino code that would run a 4 Bit Binary UP counter once a push button switch is pressed and then 4 Bit Binary Down counter on the second click. Then vice versa. This ...
-1
votes
2
answers
1k
views
I need a 10KHZ PWM signal from pin 3 and 11 using timer 2
The op of pin 11 should be inverse of pin 3. I used digitalreadfast and digitalwritefast and used simple if else. But the delay is high as 10us. What should i do?
I found this code in forum but its ...
0
votes
1
answer
163
views
Unable to get keypad key in while loop [closed]
I'm a beginner into Arduino so I have a little problem where I'm trying to do a countdown on LCD using while loop but I'm also trying to get a key input inside that same while loop. Problem is that ...
1
vote
1
answer
366
views
Square wave generator generates a shorter pulse from time to time
I am using an arduino Micro to generate 8 square waves on 8 pins. The idea is as follows: on pin 13 is the main square wave. It represents a certain BPM (beats per minute). The other 7 pins should ...
2
votes
2
answers
642
views
Using Internal Timer Interrupt to Read Analog Sensor
I'm having difficultly using an internal timer interrupt with my Arduino Nano to properly capture a specific value from a linear potentiometer and then instantly stopping the actuator.
I basically ...
1
vote
2
answers
159
views
Arduino UNO Power interruption
Do you have to upload the UNO after the applied power is disconnected?
Does the UNO retain the code without any power?
And when the power is disconnected, if the code is retained, will the timers ...
1
vote
0
answers
305
views
Using library functions in timer ISR ESP32
I'm trying to use a library function in my ISR function that uses the internal timer to trigger every 1 ms. The chip that I'm using is an ESP32-C3-MINI. Here is my current code:
main.cpp
#include <...
0
votes
0
answers
239
views
SDI-12 protocol, working with SoftwareSerial
I have a Teros 11 moisture sensor that I have managed to make it work with the SDI-12 arduino library.
However, this library does not work with SoftwareSerial and this is critical for me.
There is a ...
1
vote
2
answers
628
views
Timer 1 "Set on Compare Match" in Normal Mode - Not working
I'm using the hardware timers on the 328 for phase angle control of a triac with zero-crossing detection. I am encountering some strange behavior with the "Set on Compare Match" feature not ...
8
votes
1
answer
33k
views
The difference between "time_t" and "DateTime"
I've run into an issue trying to combine 2 different Arduino timer projects I've found online.
For both projects I'm using a DS3231 RTC, but have been able use the DS1307 library just fine in my ...
0
votes
1
answer
345
views
IMU (MPU9250) and Ticker on ESP32
I want to read the data from an IMU (MPU9250) periodically. To do that I use a ticker as shown in the following code:
#include <Ticker.h>
#include "MPU9250.h"
constexpr int ...
1
vote
2
answers
5k
views
Converting human readable date to a unix timestamp [duplicate]
Can anyone provide a sample code that would convert a human readable date like 2019-10-27 22:10:35 to a unix timestamp like 1572214235?
I found many topics about it, but they eider refer to out of ...
-1
votes
1
answer
248
views
How to read analog sensor data with different timers in arduino
I have three analog sensors like voltage, temperature and pressure. I need to measure the voltage and temperature every 10 ms and I need to measure the pressure alone every 30 ms by using the timers ...
2
votes
1
answer
147
views
Ramping servo motor taking longer than calculated
I'm learning how to code a "BOE Shield bot" with a partner at my university (first year). To clarify for those that do not know: a BOE Shield bot is a small robot equipped with 2 servo ...
-1
votes
1
answer
230
views
How to use TimerOne while calculating time?
I'm trying to get warning with buzzer while I get same values on 3 seconds. But first warning doesn't wait 3 seconds. Second warning is correct. Code is attached. BlinkLED1() method is same BlinkLED2. ...
-2
votes
1
answer
313
views
1Hz & 32Hz from 32.768 kHz on ATmega328P at 8MHz & DS3231 32K
I have a 32.768 kHz signal at the ATmega328P input.
I need to get 2 signals from this signal: 1Hz and 32Hz.
How well will it work?
How to do this with a ATmega328P Timer/Counter?
What gain will the ...
4
votes
3
answers
2k
views
Programming Arduino Uno R3 to trigger a relay once every 24 hours
I programmed an Arduino Uno R3 to trigger a relay once every 24 hours from the moment it is powered on.
I calculated milliseconds and used the function delay().
24 hours * 60 minutes each hour * 60 ...