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
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-...
0
votes
1answer
393 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 ...
8
votes
5answers
4k views

Can I make delayMicroseconds more accurate?

I'm trying to bit bang DMX data and that requires 4us pulses. Not having much luck with the results I'm checking to see how good the Arduino is at delaying... Seems to be pretty terrible at it. Here'...
-3
votes
2answers
600 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. ...
1
vote
4answers
633 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 / (...
0
votes
1answer
318 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
vote
2answers
3k views

Do AVR delay functions (_delay_us() and _delay_ms()) use timers?

I'm trying to determine if the AVR delay functions _delay_us() and _delay_ms() use timers in such a way that I can't use those timers for other functionality in my code. If so, what timer does it use? ...
1
vote
3answers
95 views

Arduino not recognizing when a timer reaches 0

Alright, so I'm attempting to make a timer that will turn on a light after an hour. Currently I have it set to 5 seconds for testing. What is happening is whenever I start the program it won't ...
0
votes
1answer
48 views

Trying to turn off fading RGB LED after 30 secs

I am trying to get something to work so that an RGB LED fades through the color spectrum, and when a button is pressed some music plays. That is not the problem. Assume I am using any loop that ...
0
votes
1answer
375 views

Where to declare timer interrupt variables?

I have a situation where the majority of the code is residing inside timer interrupt functions. Setup() does what it has, loop() basically reads ADCs and then all the code is inside timer interrupts. ...
2
votes
2answers
329 views

Is there an ICRn CTC mode interrupt vector?

I can use the CTC waveform generation mode to loop to OCRnA and trigger the corresponding TIMER1_COMPA_vect interrupt. // CTC mode TCCR1A &= ~(1 << WGM10); TCCR1A &= ~(1 << WGM11);...
5
votes
1answer
2k views

ATmega AVR frequency measurement with timer/counter

I've been rehashing some existing libraries I found on some obscure forums to measure a frequency on digital pin 5, using the ATmega328P/ATmega2560 Timer/Counter modules and an interrupt based ...
5
votes
3answers
2k views

Calculate absolute time based on cycles and RTC

I'm developing a low power data logging device. It samples sensors at the frequency of 20Hz, and also has a real time clock for absolute time (the logged time need to be exact down to ms). I think ...
0
votes
2answers
594 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 ...
2
votes
1answer
522 views

WDT and RadioHead with delay()

The core I use is this one The chip I use is an ATtiny85 I run this using the Arduino IDE 1.8.2 RadioHead ASK library (slimmed down) What I want to do is: deep sleep wake up every minute turn on ...
1
vote
1answer
285 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
3answers
502 views

ATtiny85 Timer 1 comparator A interrupt problem

I'm writing a program on attiny85 using interrupts. It is a simple program: - when rising edge is detected on PCINT0, drive DEBUG_PIN to HIGH - when TIMER1 counts up to OCR1A, drive DEBUG_PIN to LOW ...
0
votes
2answers
616 views

Arduino Due: enable reentrant interrupt

I'm using the TC3 interrupt on my Arduino Due to run some code periodically, like this: void TC3_Handler() { TC_GetStatus(TC1, 0); // Remove interrupt flag // My code... } However, as I've found ...
6
votes
4answers
680 views

Programming standalone Atmega328p-PU with NE555N timer IC

I know I may sound a little idiotic to ask, but as I have seen in the internet that to program a standalone Atmel chip like that from of the Arduino's, you need 2 22pF ceramic capacitors and a 16mhz ...
1
vote
2answers
1k views

Press on pressure sensor, then wait 5 seconds, turn on LED

I'm having some trouble wrapping my head around timers in Arduino. I've got a FSR Pressure Sensor and I want it to turn on my NeoPixel LED after pressing on it for 5 seconds. Any help is much ...
1
vote
3answers
169 views

Use registers as parameter?

I'm writing a helper class to manage timers, and I'm writing a lot of code like if (timer == 1) ICR1 = icr; else if (timer == 3) ICR3 = icr; else if (timer == 4) ICR4 =...
0
votes
3answers
67 views

Turning an LED on when an error occurs, then turn it off after 2 seconds

I am currently working on making some test equipment for µUSB cables. The code is supposed to recoqnise when an error in the cable occurs. Most of it works as expected, but I have some trouble ...
-2
votes
5answers
1k views

'setup' does not name a type?

Was trying to work some code that I found online to suit my needs and it continues to show the same error 'setup' does not name a type. I have tried setting it to void, Void as well as rewriting the ...
1
vote
0answers
386 views

Use input capture for multiple sensors simultaneously

I want to accurately time multiple digital input channels (readings from sensors) for the rising and falling edges. I need the precision of the Timer1 Input Capture. As far as I know the input capture ...
1
vote
7answers
2k 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
0answers
133 views

Arduino timer library for piezo [closed]

I found a library called Timer. I want to use timers for pieso. My code is: long ids[10]; void playNote(int pin, unsigned long freq) { float ms = 1000/freq; ids[pin] = t.oscillate(pin, ms, LOW); ...
0
votes
1answer
218 views

Is there a way to setup an interrupt to trigger at n number of clock cycles from now?

I currently have an nRF transmitter/receiver pair setup on my desk. The transmitter is sending a single byte (0xAA) every 5ms. The receiver sets an LED high to indicate that it received the byte, ...
1
vote
3answers
181 views

Calculate the time since arduino started working for a year

I want Calculate the time since arduino started working for a period of one year using arduino uno and when the period is over flip a light on
1
vote
1answer
2k views

sleep and wake up arduino mega according to ds3231 interrupt

how can I make my arduino mega sleep during 6pm-7am..and wakes or stay up during 7am-6pm and doing its job like activating the solenoid valve based on my soil moisture sensor reading.this is for my ...
1
vote
1answer
56 views

A confusion with setting timers

I was reading a tutorial on timers. My aim is to generate 16MHz pulse output from the pin 8. Here is the code I modified from the tutorial (I use Arduino's ATmega328P): #include <avr/io.h> #...
2
votes
1answer
980 views

Generating a short pulse after a delay

I am trying to use one of the hardware timers on the arduino uno to generate a short pulse some number of microseconds after receiving a pulse on an input. Currently my code looks like this: ...
2
votes
1answer
657 views

Problem with TIMER in Arduino DUE

I'm writing a code to print/update the value of sensors for each 10 ms, and I decide to use Timer instead of delay function (I'm afraid it's not exactly 10ms with delay function).But when I watch the ...
0
votes
1answer
3k views

ESP8266 Timing question / Do something in 2 seconds even

I am able to synch my ESP8266 running on Arduino core with the time.nist.gov-Server but how can I achieve to trigger i.e. a digital pin in 2 seconds even? What I mean is that following: The MC ...
0
votes
0answers
481 views

How do you program to make a random timer to start and stop to music?

I need to program a timer that will work randomly to any music playing in the background. The timer starts when the music starts and timer stops when the music is stopped. How do I do this?
6
votes
3answers
4k 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 ...
2
votes
1answer
870 views

FastLed (WS2812B) and IRRemote problem

I am trying to control my WS2812B with a remote control. To archive this, I am using IRRemote library. The problem is that this two libraries doesn't work together. I did some research and found out ...
0
votes
2answers
2k views

Arduino ATmega 2560 frequency measurement

I would like to measure frequency with an Arduino 2560 board. The approach is to use a timer interrupt set to one second and pin interrupt to count interrupts in one second. The problem I have is ...
1
vote
1answer
4k views

Which timer does Arduino Nano use for each PWM pin?

I'm unable to find which Timer controls each PWM pin (3, 5, 6, 9, 10 and 11) in an Arduino Nano Board (ATmega328). Any guesses? Thanks in advance, Eduardo
1
vote
1answer
411 views

Setting the sampling rate for timer interrupt

I had performance problems with the data acquisition and after some reading on the web, someone told to define a timer with the frequency I need (50hz): // TIMER 1 for interrupt frequency 50 Hz: ...
1
vote
0answers
564 views

FreeRTOS Implementation on Arduino

I am trying to make an RGB LED with Fan Controller for PCs. It is an Open Sourced project. But I want to implement RTOS using this implementation of it as a function in it, namely rollColor(), takes a ...
5
votes
2answers
10k views

Arduino Countdown without using delay()

I am working on a project which requires countdown from 30sec to 0sec. I can't use delay() function because I am taking input from keyboard during countdown. millis() function wont help because my ...
-2
votes
2answers
86 views

Building a low voltage disconnect w/ timer - need help with the timer

I'm trying to build almost exactly this device: http://www.reuk.co.uk/wordpress/reuk-shop-low-voltage-disconnects-lvd/buy-reuk-programmable-low-voltage-disconnect-with-display/ It is a low voltage ...
0
votes
1answer
992 views

Why does servo library conflict with irremote?

I am building an Arduino Mega robot. I am planning to use IRremote.h library for it. I am using multiple libraries in my code and I do not know which timers are taken. I always get errors when ...
3
votes
3answers
3k views

Connecting high sampling rate DAC and ADC to arduino DUE, timer consideration

I'm in the echopen association, our goal is to create a low cost, open source echographic probe. In order to do that, we use an arduino due for the first step. For doing acoustic imaging, we use ...
0
votes
3answers
593 views

Timer3 Arduino maximum period

At the moment I'm trying to learn microcontrollers with Arduino, and have a problem with the timer. Arduino works at 16MHz clock, and the best prescaler is 1024, which means the timer increments the ...
0
votes
1answer
115 views

Wait for serial input otherwise start with preconfigured options

I need to input config parameters from serial input. After a period (1 min) with no input I would like the program to start with preconfigured parameters. Currently in the loop() section I use Serial....
2
votes
1answer
369 views

Port Manipulation and serial communication

i'm working on a laser timer using arduino and i saw that using direct port manipulation can have a really better time precision. My only concern is about serial communication, because i am using some ...
0
votes
2answers
201 views

Hardware damage from executing tight polling loop over extended periods of time?

I want my project to be standing by at the ready for months and years at a time, so I started writing my code to throttle back from polling at delayMicroseconds to just delay. Like, after 15 minutes ...
0
votes
0answers
141 views

How to drive RGB LED fading alongside MAX7219s

Merry XMAS I have a pro mini which drives 2 RGB LED strips on its 6 PWM pins, via 6 2N7000 N-channel MOSFETs. Alongside these, I have 4 x MAX7219 modules in series controlled via SPI. Both work ...
1
vote
1answer
4k views

WDT & Software RESET in ESP8266 + Arduino IDE

I am working on ESP8266 in Arduino IDE. I want to know how to Software RESET the ESP8266. Any sketch/example would be useful. Moreover, how to initialise WDT in ESP8266. Kindly help!

1
4
5
6 7 8