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.
598
questions
2
votes
2
answers
1k
views
Alternative to polling interrupt flag from main loop?
I am using an ISR, which is written to be as minimal as possible:
volatile bool interrupt1{};
void ISR1() {
interrupt1 = true;
}
The interrupt is handled by polling the interrupt1 variable in ...
0
votes
1
answer
41
views
Wake esp8266 from deep sleep with PIR but disable while running code
I am using an ESP8266 to control a ring of neopixels. I want to use a PIR to trigger a brief light show. I'm using batteries and need them to last as long as possible.
I have it working by checking ...
0
votes
1
answer
115
views
Use class object inside an ISR
I have to simulate an ADC that behaves as an I2C slave. The simulated values that the ADC shall expose are sent over serial, saved on an attribute and are requested by a master device over I2C.
A ...
1
vote
1
answer
104
views
Where to find interrupt flag for 3rd-party Arduino board cores?
This question might be a bit broad, but I'm running into an apparently classic problem with Arduino interrupts, where the rising or falling edge flag is triggered prior to a rising or falling edge ...
1
vote
1
answer
27
views
Rising and falling edge on GPIO_STM32G4
I am working with STM32G491RE.I am giving pulse to GPIO pin from function generator. That pulse will be 2 msec on time and 8msec off time.I need to make flag high if the signal from function generator ...
2
votes
2
answers
84
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
317
views
How to use Interrupt in Arduino to receive the data from Serial Input
Currently i have a project that forced me to make a program that receives several data from Serial Input using Interrupt in Arduino. I use Arduino as the receiver and ESP32 as the sender through ...
1
vote
2
answers
140
views
Timer interrupt setup for one second is too slow (~ 4 seconds)
I am trying to use the timer interrupt on an Arduion Uno.
Here is a imple example code for displaying a progressive digit on a lcd display, which is updated with timer interupt every second:
#include &...
0
votes
2
answers
151
views
ATtiny85 with sleep and serial
I want to communicate over serial to another device (dfplayer) and also set the microcontroller into sleep mode.
The ATtiny85 does not have a hardware serial pin so I need to use a virtual serial (...
2
votes
0
answers
159
views
Rotary Encoder with interrupts - erratic behaviour
I'm trying to change my working rotary encoder code (stolen from here) to an interrupt-based code on my Mega2560. The trouble is that the result behaves very erratically, even though the physical ...
1
vote
0
answers
76
views
ESP32 trouble with running ledcWrite inside of ISR
ESP32-S2 (Wemos/Lolin S2 mini)
Arduino 2.1.1 on Windows 11
Hello,
Thank you for taking the time to read this post and for any assistance you can provide. I consider myself a newbie when it comes to ...
5
votes
1
answer
215
views
Pin Change Interrupt Flag timing on 1284P
I want to ask about pin change interrupts on a 1284P chip using MightyCore. I have a question about the timing of multiple interrupts on one port. Specifically, if I am servicing a PCINT vector and ...
2
votes
2
answers
430
views
Using interrupts as flags/latches without any ISR
I've got an Arduino Mega periodically running an (~400ms) operation that is sensitive to repeatable timing, so I don't ever want it to be interrupted. But, I'd like to be able to use an interrupt ...
2
votes
2
answers
124
views
Changing SPI ports on an Arduino
My end goal is to read information from an nRF24l01 module connected to my Arduino UNO R3, and generate an interrupt whenever a message is sent to the Arduino.
Now, I have read that for Hardware ...
1
vote
1
answer
125
views
How to make the built-in LED blink with a frequency of 5 Hz using interrupts
The task is: after five clicks on OK, the built-in LED starts flashing with a frequency of 5Hz using an interrupt. After the eighth click on OK, the flashing (and glowing) should stop.Why is flashing ...
0
votes
1
answer
206
views
Why NEC IR remote control decoder does not work
I need to recognize a signal from an IR remote, not to use a library for working with IR remotes/receivers. How can when the button is clicked to display its name. I have PIC12F615 microcontroller ...
1
vote
1
answer
100
views
How can when the button is clicked to display its name
I need to recognize a signal from an IR remote, not to use a library for working with IR remotes/receivers. How can when the button is clicked to display its name. I have PIC12F615 microcontroller ...
1
vote
1
answer
68
views
attachInterrupt has no effect on Industruino SAMD21
I'm using Industruino D21G (SAMD21G version) with Visual Studio Code extension for Arduino. attachInterrupt seems to have no effect. I tried Industruino CH1, CH6 and CH7 with the same result. When I ...
0
votes
1
answer
217
views
Why does the interrupt not work after pressing the button
Implement interrupt processing when the button is pressed, and the very start on the rising edge, the interrupt pin and to which the button is connected 11. Why does the interrupt not work after ...
0
votes
0
answers
124
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 ...
2
votes
2
answers
152
views
Tone() generates a high pitched sound when button is released
I have a simple circuit that makes use of the tone() function to produce some sounds.
I also have a button, hooked with an interrupt function, that whenever is pressed, a variable changes.
Sometimes, ...
1
vote
0
answers
224
views
Motor encoder and interrupts
I'm trying to write motor controller for automated blinds using Raspberry Pi Pico with arduino-pico.
My problem is that I can't seem to get a consistent result from motor encoders.
In my setup ...
0
votes
2
answers
108
views
best practice for performance: empty loop() when using interrupt?
I'm working on a little midi hardware project and I'm using attachInterrupt() to assign a callback function to an interrupt pin.
Nothing gets done in the loop function, so it looks like this:
void ...
1
vote
1
answer
100
views
Checking a thing about interrupts
If I disable interrupts (for example noInterrupts or cli) and enable them (interrupts or sei for example) later, would interrupts which would have executed in the window in between fire by the ...
0
votes
0
answers
24
views
Power saving and pc interrupts on ATMega324PA
I have an ATMega324PA and I want to power down and only wake on CAN receive (working on int 0 successfully), on a schedule, on pcints on 6 digital inputs, and on serial receive - either serial0 or ...
0
votes
1
answer
64
views
ATTiny88 missing pulses - maybe
I have been given to understand the ATTiny88 is very similar to the Arduino Uno / ATMega328 MCU. There does not seem to be a tag for the ATTiny88, so that is why I chose the tags I did. I do not ...
2
votes
1
answer
92
views
Is ESP8266 dropping an interrupt?
I want to use interrupts on my ESP 8266 to monitor the digital outputs of a power meter and water meter.
The idea is to increment a counter in the ISRs and at some point to take the value of the ...
0
votes
1
answer
203
views
DS3231 with Arduino Nano for Timing precision
I am in need to synchronize two separate circuit boards working with Arduino nano. The need is to activate one relay using Arduino-1 after 45 min and another relay using Arduino-2 after 45.36 seconds. ...
2
votes
2
answers
163
views
Arudino receiving interrupt command BEFORE entering sleep mode causing it not to receive any interrupt commands in order to wake up
I've written code for an Arduino Nano that when a button is pressed, it sends an IR command. It is set so that if no button press has been received for a period of 10 seconds, it will enter sleep mode ...
0
votes
1
answer
369
views
Arduino nano timing precision
How precisely can an Arduino nano be timed? The project I am working on needs two Arduino nano to work synchronously. Arduino one have to activate a relay after 2700 sec and Arduino two have to ...
-1
votes
3
answers
1k
views
Interrupt on button press + debouncing
I want to have an interrupt function executed whenever a button is pressed.
The button is connected to pin 2 and the GND. Therefore, the pin is turned to LOW whenever the button is pressed. In ...
1
vote
1
answer
53
views
Fubarino (microchip pic32mx), Second timer interrupt is not firing
volatile uint32_t counter_timer = 0;
void __USER_ISR myISR() {
counter_timer++;
clearIntFlag(_TIMER_3_IRQ);
}
void __USER_ISR myISR_timer_four() {
clearIntFlag(_TIMER_4_IRQ);
TMR4 = ...
2
votes
1
answer
546
views
Attiny timer interrupt does not make an interrupt every 1000ms
I'm making a stopwatch using an attiny85, the idea was to use the timer interrupts to count the seconds
my theory was: since I set the Attiny85 to run at 1Mhz, I can use a presale of 1024; 1000000 / ...
0
votes
1
answer
164
views
Why doesn't my mcp23s17 interrupts work anymore?
I'm using a teensy 4.0 with two mcp23s17 gpio expanders where #1 has 16 buttons wired to it, and #2 has 4 buttons and six rotary encoders. To run everything I'm using majenkos mcp23s17 library. ...
-1
votes
1
answer
63
views
Share interrupt service between class
I would like to share interrupt routine between class. I followed this tutorial.
But I need to call a member function in callback function, I have the issue :
This is my code :
Timer.h
static void (*...
-1
votes
1
answer
409
views
Stopwatch stop/start button and reset
i am trying to make a stop watch with a stop/start button and a reset button
i have made this
#include "RTClib.h"
//Setup the Real Time Clock, DS3231
RTC_DS3231 rtc;
const byte SQWinput = 2;...
-1
votes
1
answer
200
views
`noInterrupts()` causes the arduino to no longer appear in ports
Minimal working example:
void setup() {
// initialize digital pin LED_BUILTIN as an output.
noInterrupts();
pinMode(LED_BUILTIN, OUTPUT);
}
// the loop function runs over and over again forever
...
0
votes
2
answers
179
views
External Interrupt not working on 3.3V atmega168
I made a 3.3V board and I've put both atmega328p (that I pulled off of a 3.3V pro mini), and an atmega168 that I bootloaded (using USBtinyISP whilst selecting board "Arduino Pro or Pro Mini" ...
-1
votes
1
answer
32
views
Interrupt is sporatic, potentially after 220Hz or so
Background although likely not needed: I am recieving a frequency on the destination side of a opto isolater. A fan trips a hall effect sensor, and grounds a circuit which lights the opto. On the ...
1
vote
1
answer
111
views
Help with Arduino sleep and watchdog timer interrupt
I want to use Arduino's sleep and wakeup functionality but have hit a roadblock and can't seem to get past it. As I am just prototyping for a final system, I cannot use the LowPower library to ...
-1
votes
2
answers
208
views
Can't make attachInterrupt() work
I have an accel+gyro sensor connected to an Arduino Zero. It's configured to output an interrupt signal on pin 2 when tapped. I can do a digitalRead() on the pin, and it does go high, so the interrupt ...
1
vote
0
answers
103
views
Putting samd-based board into sleep mode
I'm using a SAMD21G18A based board - the arduino zero, for a battery-powered wearable project (a type of computer mouse). I'm trying to figure out how to put the device to sleep, when it hasn't been ...
3
votes
2
answers
2k
views
Attach the Arduino ISR function to the class member
I intended to use a timer interrupt for limited instances of a class in my ESP32 Arduino project. My first code conception was as follows:
portEXIT_CRITICAL_ISR(&lock0);
}
...
0
votes
1
answer
97
views
Safely extend TCNT1 / ICR1 to 24 bits using TOV1
I'm hoping to time external events on a '328p Arduino that will occur slowly enough that they'll overflow the 16-bit counter TCNT1. In a different scenario I'd prescale the counter, but I need the ...
1
vote
1
answer
508
views
Interval timer on Arduino: Doubt about TimerOne library
I want to synchronize a timer interrupt from a button is pressed. I want to read a button state 3 seconds later from the first pulse moment (to identify long pressed button, 3 seconds for this example)...
1
vote
1
answer
153
views
Where am I going wrong in modifying Timer0 and the ISR interrupts in this example?
(Arduino) Hello I don't know where I am going wrong here, please advise.
In the end I want to step a bipolar motor, HIGH/LOW, using Timer0 with OCR0A and OCR0B interrupts to adjust the motors step ...
-1
votes
1
answer
281
views
How do I debounce multiple external interrupt buttons?
I have an Arduino sleeping most of the time to save power and there are two buttons attached to different interrupt pins that run different functions. These functions are different from each other, ...
2
votes
1
answer
327
views
ATMega328p internal comparator problem - ISR(ANALOG_COMP_vect) not firing
After being introduced to this code on github, and exploring electronoobs tutorial I was compelled to try and recreate it with the Arduino Nano, and using the A0-A3 analog comparator inputs. Currently,...
1
vote
1
answer
87
views
PWM and attachInterrupts issues
I'm trying to control the speed of a DC current motor with PWM.
I use an arduino UNO to send PWM signal to a mosfet Velleman vma411 to change the average tension of a my motor which is wired to ...
0
votes
1
answer
97
views
State machine problem
I am trying to record the pulses from a water flow sensor using a state machine. My goal is to count the pulses until the flow stops (i.e. the rotor inside comes to rest). This will constitute a ...