Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

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
0 votes
0 answers
15 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 ...
user avatar
0 votes
1 answer
24 views

Cannot 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 ...
user avatar
0 votes
1 answer
38 views

Compare interrupt enabled in overflow interrupt behavior is not as expected [closed]

What I'm trying to do: Drive a DC motor using Arduino UNO Control PWM duty using a variable resistance and built-in A/D converter Write a program in C with direct access to the registers Target ...
user avatar
  • 27
1 vote
0 answers
27 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 ...
user avatar
3 votes
1 answer
282 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); } ...
user avatar
0 votes
1 answer
33 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 ...
user avatar
  • 221
1 vote
1 answer
102 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)...
user avatar
  • 113
1 vote
1 answer
57 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 ...
user avatar
-1 votes
1 answer
61 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, ...
user avatar
  • 170
2 votes
1 answer
57 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,...
user avatar
  • 163
1 vote
0 answers
46 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 ...
user avatar
0 votes
1 answer
64 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 ...
user avatar
  • 183
3 votes
0 answers
94 views

220v lightbulb gradual dimmer

I am trying to turn my incandescent bulb gradually,say its brightness should go from zero to 100% in 10 mins. In doing so I found the following code and it works well but it's not as gradual as I ...
user avatar
  • 31
1 vote
2 answers
79 views

stop motor instantaneous with hall sensor problem

I have a problem with stopping motor at same spot when magnet pass.. I tried to add interrupt and to make code as clean as possible but no joy so far. Any suggestions? sw will add later, just ignore.. ...
user avatar
  • 11
1 vote
1 answer
100 views

Correct usage of SPI with ISR

My Arduino needs to do: Run ISR as many times as possible/ as fast as possible. Occasionally receive data over I2C. Output data over SPI in ISR. My question is regarding SPI and ISR. The ...
user avatar
1 vote
1 answer
54 views

Why does Arduino Due appear to halt after single call to ADC_Handler?

In the simple example below I just software trigger an ADC acquisition and then set the builtin LED's digital out in the interrupt handler. I don't know why the program appears to halt however. void ...
user avatar
2 votes
1 answer
60 views

Comments change compiled behavior (sysTickHook weak reference override)

I have a very simple routine that lights up the built-in LED (pin 13) when a system tick timer fires off its interrupt. I override the weak reference to int sysTickHook(void) found in hooks.c. I found ...
user avatar
-1 votes
1 answer
39 views

Cannot change pointer for port in main loop

I am testing on an Arduino UNO. I want to use timer1 and interrupts to create various LED patterns. The LEDs may span multiple ports i.e PORTB and PORTD. I want to use a "volatile uint8_t*" ...
user avatar
1 vote
1 answer
56 views

Adding an Interrupt to ATtiny45 with Arduino

I recently wrote a simple script to...we'll say, "flash some LED's" and uploaded it to an attiny45. In short, the script cycles through 3 LED's and turns them on for a specified frequency, ...
user avatar
2 votes
2 answers
291 views

Keypad pin as an interrupt (Wiring or programming)

I have this project of a "phone". It consists of: Arduino DUE, 4x4 Keypad, SD Data shield, a phone receiver detect (on/off) an Amp and a Speaker. In the beginning, after the phone receiver ...
user avatar
3 votes
2 answers
440 views

MPU6050 Arduino Jeff Rowberg library interrupt Issue

I was trying to get the data from MPU6050 using the Arduino library mentioned here. The following code is an edited version of the sample code given in the library folder which seems to be working ...
user avatar
  • 171
2 votes
0 answers
123 views

External Interrupt and Input Capture pin | Arduino MEGA

I have a code for finding the rpm of one system calling here as engine , the engine have a hall sensor output and I have tried the following Code #define SERVO_MIN 2000 #define SERVO_MAX 4000 struct ...
user avatar
  • 171
3 votes
1 answer
78 views

False interrupt triggering Arduino Mega

I am using Arduino mega with 4 interrupts to find the rotation speed of 4 motors . For this I have used INT2, INT3, INT4, INT5 and the code for the same is given below struct Pulse { uint32_t ...
user avatar
  • 171
1 vote
1 answer
69 views

Interrupt takes longer than expected [closed]

I am trying to write a delay function in C, which should take 0.5 seonds then carry on. I am aware that there are libraries for this purpouse, I want to make it myself. #include <avr/interrupt.h>...
user avatar
1 vote
0 answers
73 views

Arduino powered with 12v and interrupt noise

Hi i've a big problem with my project. I realized a simple project with Arduino Uno: i've attached interrupt to pin 2 to read water flow. If I power on Arduino from 5v usb all works as expected: my ...
user avatar
1 vote
1 answer
74 views

I am building a coin operated machine and am using arduino uno its working but i have to press the switch twice for credit to show on seven segment

int pin1 = 8, pin2 = 9, pin3 = 10, pin4 = 11; volatile byte num = 0; int coinPin = 2; void setup() { Serial.begin(9600); attachInterrupt(digitalPinToInterrupt(coinPin), inc_counter, RISING ); ...
user avatar
1 vote
1 answer
80 views

Using Arduino LMIC library with EnableInterrupt

I am using the EnableInterrupt library, infact the only library that I can find that allows me to use six interrupts to wake the Arduino. However when I use it with the LMIC library (Matthijs Kooijman ...
user avatar
1 vote
2 answers
161 views

Back EMF from Relay causing trigger on INPUT pin

I am wiring up a light show for my pickup truck. I have installed various high power spotlights and light bars into a dedicated relay/fuse box in the engine bay. These relays are wired into a switch ...
user avatar
  • 113
1 vote
1 answer
98 views

Push button unexpected increment/decrement. I'm using attachInterrupt

I'm new to Arduino and need assistance from knowledgeable people. I'm having a problem with my code, which allows the user to increase or decrease the number by pressing buttons. From time to time, ...
user avatar
  • 13
0 votes
1 answer
68 views

Save Watchdog ISR Return Address in EEPROM

If the WDT ever fires, from the ISR I save some info in EEPROM for later diagnostics before I drive the reset pin. Stack size, heap size, etc. It might also be useful to know where the code was when ...
user avatar
0 votes
1 answer
33 views

Unable to get readings for "Motor with Encoder"

I've posted to the DFRobot forum, who makes the FIT0186 motors, but no one seems to be replying there. So, excuse the copy pasting. It's probably an issue with the motor/encoder, but perhaps it has ...
user avatar
  • 103
1 vote
1 answer
36 views

Arduino Nano skips statements after Interrupt

I am using an Arduino to control an AC Phase Control Circuit to control some lamps. The problem is that the interrupts seem to break the code inside the loop(). This Code should just blink one lamp. ...
user avatar
  • 31
0 votes
2 answers
291 views

Invalid use of void expression (how to use function pointer with input)

I'm defining an attachinterrupt and I'm running into an error. The line in question is: void setup() { attachInterrupt(digitalPinToInterrupt(stallsense1), changedirection(1), RISING); ...
user avatar
  • 3
1 vote
1 answer
60 views

How to get time from RTC after wake up from sleep?

I have a setup with an Arduino Pro Mini, a DS1307 RTC, a microSD shield and a microswitch. I've set an interrupt to the microswitch, so it'll wake up the Arduino when it changes status. Here is some ...
user avatar
  • 123
0 votes
1 answer
26 views

Run computation only on request over serial

An Arduino Nano is set up to perform A/D conversions and send results out over Serial. Currently the code structure is like loop() { delayUntilNextTargetTime(); measure(); ...
user avatar
  • 133
1 vote
0 answers
196 views

ESP32 can't enter interrupt anymore after interrupt appears during delayMicrosecond function

I have a strange problem with my ESP32 project. I use an ADPS-9960 for gesture control which triggers an external interrupt. In the interrupt handler itself I only set a variable that causes the ...
user avatar
2 votes
3 answers
91 views

Send button only works when pressed immediately after

I am new to Arduino and I am trying to create a Morse code based "chat". I can submit a message in Morse code using the send button (the one on the right,) and when I press the button on the ...
user avatar
2 votes
0 answers
65 views

Unknown text printing on Serial Monitor [closed]

I want to use the Serial Monitor for some debugging, but it prints something else. Edit- This only happens if I use the attachInterrupt() function I tried another program that does not use interrupts ...
user avatar
  • 452
0 votes
1 answer
74 views

Check pin capabilities at compile time

Are there board-independent functions to check pin capabilities at compile time? I.e. Can the pin be used as output, as in digitalWrite()? Does the pin support PWM, as in analogWrite()? Does the pin ...
user avatar
1 vote
0 answers
188 views

Servo motor won't work for a specific code

I have written a code with interrupts to control the servo but my servos are not working. One is meant to work with interrupt but the other one has to simply move but it is also not working. Even the ...
user avatar
1 vote
1 answer
200 views

Dealing with noise in arduino interrupt

I'm makeing two modules, module2 gets sensor signal, and send wireless message to module1, with HC-12. Then module1 is going to do some work it is supposed to do. Circuit configuration is in the ...
user avatar
0 votes
2 answers
315 views

Using MCP23017 with 5 rotary encoders, WITHOUT missing a single step from any of them?

I have recently followed the instructions in the answer to this question: Reading several rotary encoders posted by maximilian-gerhardt I've wired everything up, and am using the interrupts example ...
user avatar
1 vote
0 answers
138 views

Issues with interrupts coming from RTC DS3231 and power supply interference

Several months ago I developed a device able to detect water flood in a closed space and do some operations in case (closing valves, issuing an acoustic and Bluetooth alarm etc.). After 8 hours it ...
user avatar
  • 11
2 votes
0 answers
31 views

Generating Externally Triggered Complimentary PWM with Arduino Due

I need a 2KHz complimentary PWM waves with adjustable duty and phase that is triggered by an external 4KHz source. After reading the datasheet I think there might be 2 way to do this: Use a TC unit ...
user avatar
  • 209
1 vote
1 answer
122 views

Is it advisable to use Serial.write in an ISR when loop() routinely uses Serial.read?

I do not know much electronics. I have Nano v3 as I2C master, it reads 5-byte packets (of delimtted data) from PC's USB port, processes it and forwards it. I now need to implement a way to signal PC ...
user avatar
0 votes
1 answer
277 views

LED does not blink - Arduino UNO+WiFi R3 ATmega328P+ESP8266 board

As I am learning the Arduino coding, I want to see if my program can turn on the LED light. I have tried all the things, but the code does not start the LED light I have installed on the board. The ...
user avatar
1 vote
1 answer
193 views

Arduino Uno's Timer maximum frequency using Timer Compare Interrupt, not Timer Output Pins (e.g. OC0A)

I want to achieve the generation of a custom binary signal over a digital pin at the highest possible frequency on Arduino Uno. Using Timer's output pins (e.g. OC0A), one can get a pin to toggle at a ...
user avatar
1 vote
1 answer
78 views

where is the digitalPinToInterrupt macro defined

I am new to arduino, and it's confusing to me how you can just write code in the IDE and use functions or macros such as #define ISR() in the avr-libc library without having to include the header file ...
user avatar
1 vote
0 answers
124 views

Arduino unable to wake up using interrupt after sending SMS

my use case is that I am building a distance sensor using Arduino Uno. The idea is when the distance is between a threshold, an SMS is sent from the device. I am using DS3231, SIM800L, and HCSR04 for ...
user avatar
  • 11
1 vote
1 answer
105 views

Alternative to a delay so it can be interrupted

I have task which includes a 30s delay in the void loop. During this delay I want to be able to press a key on a keypad and have a message displayed on the serial monitor as an emergency stop. Since ...
user avatar
  • 23

1
2 3 4 5
12