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.

Filter by
Sorted by
Tagged with
0
votes
0answers
48 views

StepperLab3 library and Liquidcrystal

I want to control a stepper while displaying user menus on a freetronics style 16x2 LCD. I'm using liquidcrystal for my menus and in order to get non-blocking control of the stepper I've imported the ...
1
vote
2answers
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; ...
0
votes
1answer
1k views

Clock generator up to 8 MHz using pin 3 arduino nano

I would like to generate square signal up to 8 MHz using internal timer of arduino, I have done successfully in pin 11, but i want to change it in pin 3, but still stuck. Here is the code pinMode(11,...
0
votes
0answers
145 views

Due timer update

I want to test a BPM counter as a part of larger project rewriting code for a groovesizer synth. In essence i want to read a pot for updating BPM tempo, and then have a LED blink that tempo, ...
0
votes
0answers
253 views

PCM library - Timer0

I would need a quick help if possible because I have a project with the deadline tomorrow night. On my Uno (atmega328p in fact), I need to communicate with a SPI flash to transfer music and then, take ...
0
votes
2answers
624 views

Can I simulate a clock without an RTC connected? [closed]

I want to program for a timer that works as set timer such as in an oven where user can set their own time. One of the way I know is using an IC(RTC) for the timer. However, I don't have the IC yet ...
0
votes
1answer
922 views

Timer0 overflow interrupt not working

I try to use the Timer0 of an Arduino Leonardo (ATmega32u) to trigger an interrupt at regular intervals, using plain avr-gcc (not the arduino library). I try to blink the built-in LED as test, but it ...
0
votes
0answers
36 views

Timer Interrupt Default Settings

so I am testing out the PulseSensor code from here: https://github.com/WorldFamousElectronics/PulseSensorAmped_2_Sensors/tree/master/PulseSensorAmped_2_Sensors_1.5.0 In the interrupt.ino file, there ...
0
votes
0answers
85 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
0answers
908 views

Using the TimedAction library

I need to make use of the TimedAction library for a project. The Arduino website gave an example of how to use this library which you can see here: #include <TimedAction.h> //this initializes ...
0
votes
1answer
221 views

What is better approach for non blocking pid algorithm?

I'm developing software side for 3 axes robot where are 360° continuous rotating servos used Documentation here these servos have its own feedback system so it's possible to control it's position ...
-1
votes
2answers
38 views

How to create a device with buttons that records when they are pressed [closed]

I want to build a very simple device, which has a bunch of buttons for switching "settings" and LED lights to show which "setting" it is on. I also want it to record the times of the transitions ...
1
vote
2answers
862 views

Stop Arduino Timer after some seconds

I'm building a basic program that when a button is pressed, a buzzer comes on. I would like however to make it so that the buzzer stops after a short period of time (e.g. 5-7 seconds). Here is the ...
2
votes
4answers
454 views

Build a timer that starts and stops timing when 2 wires are broken

I need to build a timer that uses the breaking of copper strips to trigger its starting and stopping. The intention is to measure the speed of a rocket with this - it will break the first wire, ...
0
votes
1answer
852 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
1answer
712 views

How to make timed loops after switch / case?

I am working on a code, which is running a function once a second: switch (gearbox1) { case 1: //manually close Serial.println("Closing1"); digitalWrite(gear1OpenPin, OFF); t....
2
votes
1answer
138 views

Using timer2's ISR instead of timer1's in Arduino wiring.c breaks Serial object

I want to change timer0 frequency because I need to use 4 PWM pins at a frequency lower than 500Hz and the SPI on an ATmega328. So I changed timer2 to Fast PWM with 64 divisor, enabled the overflow ...
1
vote
1answer
570 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 ...
0
votes
3answers
386 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 ...
1
vote
1answer
87 views

ATMega328p (Arduino) Timer1 set-up

I am trying to measure AC power using an Arduino with an Atmega328p. In summary, I want to use timer1 to make an interrupt every 400us where I measure two ADC channels (A0 and A1) and put them into ...
0
votes
0answers
2k views

Measuring Time while using interrupt pin

I have a very fast signal connected to pin2 of an Arduino Mega 2560. The signal is a square wave of approximately 500 000 Hz. I would like to measure the frequency of this signal. First approach ...
1
vote
1answer
1k views

understanding timer overflow detection code

I am trying to understand in details the (great tutorial and) code of Nick Gammon ''Improved sketch using Timer 1'', available here: http://www.gammon.com.au/forum/?id=12075 . I post the whole code at ...
-1
votes
1answer
286 views

Arduino Nano timer, please advice [closed]

I'm new here and in the Arduino world. I try to put together a system to cut the power of a LED night light after a preset time. The light is powered by a 5V accu and I would like to avoid to re-...
0
votes
1answer
319 views

Timer1 firing immediately

I'm trying to use Timer1 to get fired once a certain event occurs (about 1ms after the event). Using the timer to get a periodic interrupt works fine, but the very first interrupt fires immediately, ...
2
votes
1answer
7k 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 ...
1
vote
2answers
546 views

Using RTC DS3231 + Arduino UNO to calculate time lapsed [closed]

I am a beginner with no coding background. I am trying to figure out an alarm that tells people how long they have been sitting on their chair. The concept is very simple when the person would sit in ...
1
vote
3answers
652 views

How do I call functions sequentially without using the Delay function?

I've been messing with the Adafruit Neopixel lib, and I'm trying to replace some of the delay functions with mills ( so that I don't block the serial port ). So far I have the following code; void ...
2
votes
1answer
8k views

Arduino continuously reading ADC value using interrupt

I have a mono jack audio act as analog input for arduino UNO. The microphone outputs voltage that varies in terms of amplitude (volume) and frequency. In order to get the high sampling rate, I use ...
0
votes
0answers
135 views

R24 Incompatibility with TimerOne on Nano

I am attempting to build a sketch on a Nano which receives a regular pulsed signal from an NRF24L01+ board and uses the time-interval between pulses to generate a regular pulsed output generated by an ...
0
votes
0answers
256 views

Stuck at initializing input capture

I am using MEGA 2560 with 1.8inch TFT screen. I am trying to use input capture (shown in the code below) feature along with TFT display (1.8inch TFT display). Now when I individually test the input ...
1
vote
3answers
12k views

TimerOne.h library for nodeMCU

Following is the code I found in Arduino example files. It compiled fine on Arduino UNO. But there was an error when I tried to compile it for nodeMCU 1.0(ESP 12E Module). #include <TimerOne.h> ...
2
votes
2answers
2k views

How can I set up a watchdog interrupt vector timer on the Arduino Redboard/Uno?

I'm trying to set up a watchdog timer interrupt to execute a routine in the WDT_vec ISR at some recurring interval. I don't want the processor to reset, just to execute the code in the interrupt and ...
0
votes
1answer
533 views

Arduino Nano v3: is it possible to PCM + AltSoftSerial?

I wonder is it possible to change PCM.h 's lib use of 16-bit timer1 to another 8-bit? Now I'm getting libraries\AltSoftSerial\AltSoftSerial.cpp.o (symbol from plugin): In function `AltSoftSerial::...
0
votes
2answers
831 views

Arduino core structure and timer usage

I needed to use TC1 for input capture, but also analogWrite() and an approximate 1 ms interrupt to poll the user interface (encoder, button). The Arduino Nano's ATmega328p (datasheet, beware: a lot ...
0
votes
1answer
1k views

Reduce PWM Frequency Arduino DUE

I'm newbie in arduino due. I need to reduce the default PWM frequency of arduino Due. Anyone have any tutorial to do this? (Frequencys like 25hz, 50Hz for example) I read in some posts, if i change ...
0
votes
1answer
248 views

PWM on Pin 4 - arduino Micro

I am using Arduino Micro. Is there any way to use PWM on pin 4 instead of Pin3 ? I tried to change pins_Arduino.h but didnt worked. //#define digitalPinHasPWM(p) ((p) == 3 || (p) == 5 || (p) ...
1
vote
2answers
318 views

Cannot create a PWM with 20% duty cycle using micro() timer

I have been working with Arduino for almost a year, because I found it easy for beginners in electronics. But now, I have a major problem, I'm trying to get rid of my delay() function because I want ...
2
votes
1answer
21k views

Getting BPM from the given code

I have found code that can blink an LED on Arduino according to Heart Beat. I am using AD8232 as a sensor for Heart Rate. Code for it is: // Variables int PulseSensorPurplePin = 0; // Pulse Sensor ...
0
votes
3answers
686 views

Disabling Timer2

I am working on a Heart Rate Monitoring project, using this Sensor from sparkFun, plugged to Arduino pro mini and reading proper BPM, I have an LED connected to pin 13 of my Arduino that blinks when ...
2
votes
2answers
2k views

Timer Prescaler problem

I am working on a project which requires use of 16bit timer . I am using Arduino Uno (Atmega 328p) board and Timer_1 (16 bit timer ) in Overflow mode. i want to use 1024 prescaler settings. ...
2
votes
2answers
479 views

How to read a timer's value once stopped?

I've downloaded the Timer1 library but unfortunately it seems that the read() method has been removed from it. I tried also SimpleTimer library from the arduino website but the program didn't compile ...
1
vote
1answer
448 views

Arduino timer ctc mode 4 vs 14

I'm trying to gain an understanding of the Arduino timer and interrupts, particularly the CTC-modes 4 and 12. I wrote a small example in which I generate interrupts while the mainloop sleeps for 1 ...
2
votes
4answers
6k 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
2answers
206 views

Is it ok to declare variables inside timer interrupts?

I am building a real time audio application using the Arduino DUE. This application needs big arrays like: uint16_t sDelayBuffer0[46000]; The Due has only 96kb of RAM available so this array just ...
0
votes
1answer
373 views

Which Timer can I use on the Arduino/Genuino Micro?

I'm trying to implement charlieplexing with bit angle modulation on my Arduino Micro, and for that I need to use the internal timers. Which timers of the Atmega32u4 are unused by the standard ...
0
votes
2answers
518 views

Making a 7-hour timer-based relay

I want to make a very small 7-hour timer circuit that can turn on a relay after 7 hours. I am trying to make the first prototype with an Arduino Nano but I can't understand how to program it for such ...
1
vote
4answers
614 views

Problem with the Frequency meter code

I am trying to build a frequency meter using Interrupts and Timer1, which works as if the system receives an Interrupt it would get the timer's data and would calculate Signal's Frequency = 1 / (...
1
vote
5answers
152 views

Would this substitute for an Interrupt timer?

class Pseudo_Interrupt { //only cummulative time is important, exact interval is not // Class Member Variables // These are initialized at startup long OffTime = 1000; // milliseconds of off-...
-3
votes
2answers
538 views

If this the way to generate a BEEP for a second [closed]

This buzzer needs to generate an audible sound for one second. The Buzzer is inside a function that is called by a loop that continues to run. It is possible to stop the loop for this one second. ...
0
votes
1answer
307 views

Code flow execution between loop() and timer interrupts

My platform is the Arduino DUE. I know that the timer counts up to a certain value, then generates an interrupt. In the Arduino DUE, you can specify the timer value. In other words, you can specify ...

1 2
3
4 5
7