Questions tagged [interrupt]

Interrupts allow the processor to suspend normal operation temporarily so that a high-priority software or hardware event can be handled instead.

Filter by
Sorted by
Tagged with
2
votes
1answer
1k views

PIR sensor and sleep (interrupt) on Mega2560

So I was starting to gain some knowledge on the PIR sensor and how to let the Arduino 'sleep' while there is no movement detected by the PIR. I found the following code somewhere and looked fairly ...
0
votes
2answers
32 views

Atmega collecting and relaying interrupt calls

I like to collect all possible interrupt and relay them to an alternative handler interrupt table what the user can set. In order to do this i have to: 1) collect all/any interrup request 2) ...
0
votes
0answers
23 views

Alternative for Particle Photon's Timer

I am converting a program made for particle photon to a Mega, everything is working except for the interrupt timer. The code that is of concern is (it's a .cpp file being included in the main .ino) ...
1
vote
2answers
1k views

Hardware Interrupt Triggered Randomly

So there is this pretty generic part of my project that involves triggering an ISR that will flip a boolean value. I have set up the software side like so: void setup() { attachInterrupt(...
0
votes
2answers
115 views

Debouncing a button with interrupt

I tried to follow the answer here: https://arduino.stackexchange.com/a/18545/51302 Unfortunately I can only get the interrupt to go once (on serial monitor is the time of that first interrupt), then ...
1
vote
2answers
323 views

Attiny85 Timer 1 comparator B doesn't work properly (while A does)

I'm writing a simple program that is using Timer 1 comparator B to generate a square wave on DEBUG_PIN. So my code at first turns on timer 1 with prescaler 8192 so that one tick is approximately 1ms....
1
vote
1answer
37 views

Attiny85 Watchdog fires only once

I build something like a flashlamp with different modi. From the hardware site it's quite simmilar to the Nanjg105c. There is a Attiny85 which generates a PWM signal to an AMC7135. I have one push ...
0
votes
1answer
45 views

Variable updated in ISR is miscounting

I'm using a timer to fire a interrupt in configurable time periods. In that ISR, a pin is toggled, and a uint32_t variable is incremented. In the main program, a while loop waits until that variable ...
1
vote
2answers
51 views

Interrupt is activated as soon as I insert a jumper wire into the port

I have written a very simple code to test the interrupt functionality of my Arduino Uno expansion board: const byte buttonPin3 = 3; void setup() { pinMode(buttonPin3, INPUT); attachInterrupt(...
0
votes
2answers
311 views

generate two phase-shifted PWM pulses triggered by frequency-divided external signal with Arduino uno?

I have a 4kHz pulse as trigger and I need two phase-shifted PWM output with divided frequency from arduino uno. Now I've managed one PWM output using the following code: int cnt = 0; void setup() { ...
4
votes
2answers
6k views

Sending serial data in an interrupt

An ATMEGA328-P chip is used with a toggle switch attached to pin 8 and a momentary switch attached to pin 9. My objective is to send the following information over serial: The status of pin 8, every ...
0
votes
0answers
19 views

pulseIn on ESP32 return 0 regularly

I'm using pulseIn on an ESP23 for measuring a frequency between 500 Hz and 10 KHz. I measure both the HIGH and the LOW time, as all simple examples suggest. 95% of the time the result is correct, but ...
1
vote
2answers
2k views

Multiple buttons on single interrupt, how to debounce?

Buttons on separate interrupt pins work fine (triggered on FALLING), bouncing is handling by forcing a 80ms lockout period during which further presses are ignored. I like that solution for being ...
0
votes
1answer
664 views

Arduino Zero - Stepper control (interrupt)?

I have a stepper controller board that I need to pulse every 40 uS or so. I also have I2C sensors and Serial writes to preform. Currently I run an update call in a tight loop, but the I2C sensors ...
0
votes
1answer
29 views

24/14 second countdown timer or shot clock for basket ball start/stop button doesn't respond well

Start button doesn't respond correctly, i can't figure out whats wrong with the code ? pls help, this code is for 24 second and 14 second countdown timers in a same unit comes with three physical ...
0
votes
3answers
45 views

Arduino Uno not working after Short-circuit

While wiring up my new Arduino Uno R3, I accidentally shorted the 5V pin and the GND pin (for less than a sec). It was powered by a 12V 500mAh power supply through the Arduino DC power jack. . The ON, ...
0
votes
1answer
35 views

Is it possible to put priorities between external interrupts?

My question is quite simple. I am using one external interrupt on the Mega2560 to wake it up with an alarm from the rtc DS3231 and record data from sensors for about 30 seconds and I would like also ...
0
votes
0answers
54 views

How to manage interrupt from accelerometer BMA220?

I would like to use the interrupt register from the BMA220 accelerometer in order to detect high-g shock. I am using a Mega2560 and the sensor is powered by 3.3 V. I use a voltage divider to convert ...
0
votes
1answer
41 views

How do I redefine the overlfow of compare interrupts in Arduino programming?

If I'm programming a pin change interrupt I can call attachInterrupt at various points in my code and change what function is called when the interrupt occurs. The overflow and compareA/B interrupt ...
0
votes
1answer
330 views

set arduino own timer about 5 minutes

I want to program arduino uno by using it's own timer , which instructions and codes should be used if i want timer to be set for 5 minuets and then warn me about an event , the problem is that , the ...
0
votes
1answer
1k views

Tone inside interrupt

I am trying to play a tone with a buzzer connected on an arduino nano pin. I have also connected a reed switch with INPUT_PULLUP on INT0 and a led. The program loops continuously (it's an ...
0
votes
1answer
477 views

How to avoid electromagnetic interference on ESP32 input

I've realized a simple circuit like the following, in order to implement a rain gauge that I can access via HTTP: With the following sketch: #include <WebServer.h> #include <WiFi.h> #...
1
vote
2answers
831 views

Using INT2/3 on Arduino Micro (Atmega32u4)

My project is using almost all the pins on this board and I require an interrupt pin to read radio state (rather than polling). I'm using I2C, so that leaves INT2 and INT3, which are the TX and RX ...
1
vote
0answers
50 views

How to wake up Arduino with an rtc?

I am doing a data logger with an Arduino Mega2560 and I want to use a code to make it sleep when no measure is needed and wake it up with an RTC when time comes. The reason I want this is because I ...
5
votes
1answer
1k views

Leonardo-based tachometer?

I'm new here. I'm not a native speaker, so pardon my English. I just received my Arduino Leonardo today. I tried some basic calculations and stuff like blinking and LCD interfacing. Its interesting. ...
2
votes
4answers
7k views

Using rotary encoders with pin change interrupts

I'm using an Arduino Uno and two (3-pin) rotary encoders for a project. Since the loop takes a bit long and accuracy is important, I'd like to use interrupts to read the values from the rotary ...
0
votes
1answer
368 views

Data is not sending to Thingspeak using SIM900 with an interrupt in the code

I'm currently working in a weather station with online recording on Thingspeak. When I send a set of parameters (T, Pressure, Humidity, light), I don't have any problem with sending data. But when I ...
0
votes
0answers
25 views

Possible race condition using ADXL345, external interrupts and sleep

Setup: I have an Adafruit ADXL345 attached to an Adafruit feather 32u4, via I2C lines and an interrupt line. Goal: The microcontroller should be in a sleep condition when acceleration values are ...
0
votes
1answer
411 views

Having issue using Arduino IRQ handler in nRF51822

Could anyone please help me as I currently using nRF51822-Arduino library with a nRF51822 chip and I couldn't call the interrupt function, wakeUp(). Currently I connect the external interrupt pin to ...
0
votes
2answers
65 views

how to interrupt the loop function and restart it?

I have a project with some NeoPixels and other LEDs and an Arduino UNO. Once switched on, the defaultLEDAnimation with colors and blinking, etc. starts. I want to trigger some other animations, so I ...
1
vote
1answer
763 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
1answer
347 views

Capturing interrupt on both edges when it's set on RISING or FALLING

I've been trying to capture rising edge of an IR sensor output. This sensor's Vcc connected to Arduino 5V and it has a digital output pin. I've observed the digital output pin on an Oscilloscope. It's ...
0
votes
0answers
126 views

How to attach interrupt to RBDlibrary?

I am pretty new to arduino programming. I want to use the library from the Robotdyn dimmer modul with a arduino uno and a encoder with lcd for a menü but if i attach the interrupt for the encoder (on ...
0
votes
1answer
83 views

ESP - Nodemcu amica - attachInterrupt crash program

I get new boards from the shop but they are little different from the previous version. I got software what works ok on Nodemcu lolin v3 now I get Nodemcu Amica what is almost same board but if I got ...
0
votes
0answers
369 views

ATTiny85 arduino interrupt

i would like to know why my code running on the ATtiny85 1Mhz does not wake up after the interrupt. I use the ATTiny Core. #include <avr/sleep.h> // Sleep Modes https://www.nongnu.org/avr-...
0
votes
1answer
31 views

GY91 IMU module, Interrupt?

Are there interrupt Pin in the GY91 Module? If not, are there good alternative for periodic sensor reading? (apart from mcu schedule/external timer)
-1
votes
1answer
30 views

Does DmxSerial stops interrupts?

I am trying to build a setup with an Arduino Mega, having a DMX output (using DMXSimple library), and a MIDI library (to be done). I was wondering, if I get into problems. According to This question, ...
0
votes
0answers
14 views

Why is my quadrature encoder writing as irregular intervals in serial monitor after working fine?

I'll try to keep this brief and add code/output at the bottom. I am using an Arduino Uno with a Pololu motor shield and two Pololu motors. I am driving speed control using the encoders at the ends of ...
4
votes
2answers
70 views

Writing to sd card with a sampling rate 50ms or less? I have a sketch that writes to sd every 1s but jams at faster sampling rates. Please help?

My code below reads data from an ADC and 3 digital pins via a Mega and prints to an SD Shield (Deek Robot). I want to be able to read the data every 50ms (20ms ideally). I can't get below 250ms. I've ...
0
votes
0answers
18 views

How to adapt this code using a DF Mini Player and interrupts for the ATTiny85?

So I programmed my Arduino Mega 2560 to play certain sound effects from a DF Mini Player that I have. I took the base code that I modified from online so some fo the names might seem odd. Currently, ...
0
votes
0answers
33 views

How to get interrupt while in sleep mode?

I am using Arduino-uno, attached ESP-01 module I want to give interrupt when I send some wifi-signal to arduino, which is in sleep mode. so I write this code: SoftwareSerial esp(2, 3); // RX, TX ...
0
votes
0answers
30 views

Combining ADC IRQ with SPI peripherals results in SPI not working

I'm working on a pet project that requires ADC, SD card (SPI interface, SdFat library) and a display in the future (also SPI). I have put together a piece of code that initializes ADC at the highest ...
1
vote
1answer
103 views

Motors triggering Interrupt

I am using a 4wd robotic car to measure straight distances. I have attached two encoders on the front two wheels to measure the distance and I am using the back two wheels to adjust the car and keep ...
1
vote
1answer
494 views

ADXL345 Arduino UNO data_ready interrupt

I would like the sensor values to be updated each 10ms(100Hz) and then run the algorithm and repeat the same process. However, after timing the algorithm it is taking only 2ms, I think the data_ready ...
3
votes
2answers
450 views

Interfacing Logitech Joystick to Arduino and interrupt a while loop

I am working on a project of a robot arm. The joints are made of servo motor. The basic function can be describe as: The robot arm (the servos) were moved manually by the Logitech joystick. The user ...
1
vote
1answer
22 views

Timer 1 COMPA ISR - default behaviour?

I'm creating a LCD frequency generator. When TIMER1 reaches a set value, it's set to toggle Pin 9 (via OC1A). Accidentally, I left the TIMER1 "interrupt on compare match A" enabled, but never ...
3
votes
3answers
784 views

What is the right way to query an I2C device from an interrupt service routine?

The ADXL345, for example, requires that interrupts are responded to by querying the INT_SOURCE (interrupt source) register. In example code for the SparkFun ADXL345 Arduino Library, there is code that ...
0
votes
0answers
23 views

How do I have this audio and LED activate ONLY when a button is held using an Arduino?

I have this code that I am using to play a sound effect where I used a program called wav2c to convert a .wav file to number values that I put into a header file that I use in the code to generate the ...
0
votes
1answer
98 views

Interrupts arduino interrupting serial comunication

I have problem with communicating VB.Net-Arduino. It seems the interrupt pause my serial communication line in void loop() { ... }. I don't know what to do, and I can't erase interrupts line since I ...
0
votes
1answer
58 views

Rotary encoder using interrupt

This is my first time working with a rotary encoder and interrupts. I am using a Pro Micro which has interrupt pins at pin0 and pin1. The code below works as expected. My question: do I need to use ...