Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
2answers
30 views

Constant ADC sampling rate on ESP8266 or ESP32

I want to sample Sound input with either an ESP8266 (preferred) or ESP32. As I'm using a low pass filter anyway, a sample rate of 1000-2000hz would be totally ok. What is more important, is that it is ...
1
vote
0answers
275 views

Rotary Encoder on LoLin NodeMcu increases value when rotating right/left

I have a test program running on my LoLin NodeMcu board, with a Rotary Encoder connected. I use Task.h and RotaryEncoderTask.h from this library: https://github.com/Makuna/Task (though my issue is ...
0
votes
1answer
30 views

External Interrupt Pins on Nano Clones

Long time lurker, first time poster here. Do the cheap Arduino Nano clones such as this one have external interrupt pins? For example, the original Nano has pins 2 and 3 usable for interrupts. Do ...
0
votes
0answers
37 views

MEGA2560 only starts program after pressing RESET button multiple times

I am working on a program where I am controlling an MP3 player by using UART between my MEGA2560 and the MP3 player. The MEGA2560 sends serial commands to the MP3 player when external interrupts are ...
-1
votes
0answers
24 views

i2c callbacks occur in wrong order

I'm trying to implement a an SMBus slave and discovered that when the master sends a SMBus ReadByte command, the onRequest and onReceive occur in the wrong order on both a Uno and a Zero board. Some ...
1
vote
0answers
624 views

ATtiny85 Comparator C interrupt on timer 1

I have a program that uses Timer1 comparator A in CTC mode. I realize that I need to set OCR1C for the timer to reset at given value. However there is no such thing as an interrupt generated by timer1 ...
2
votes
2answers
54 views

RGB LED Mode toggle - Trying to avoid using main loop()

I'd like to start by saying that I have only been dabbling in electronics (not just Arduino) for about 3 days now. I am trying to write a sketch which changes an RGB LED when a push switch is pressed....
0
votes
3answers
53 views

Can arduino interrupts occur in a middle of if statement?

I got an issues from few days, got some code which reset millis time on successful i2c communication, if not it restart an relay after specified period of time. Here is part of the code: if ((...
0
votes
2answers
37 views

Two rpm counters with interrupts

Can I use two interrupts on to count rpm square signals coming from two hall effect sensor modules (that has built in comparators to generate square signals) ? What if two signals come together ? ...
1
vote
1answer
139 views

Threshold to wake up signal

I have a sketch to put to sleep and wake up an Arduino Pro Mini 5V, but the problem is that sometimes when it is moved fast it wakes up itself, thing that I do not want. I have it configure to be ...
0
votes
0answers
27 views

High speed rotary encoder with Arduino MEGA

I'm trying to develop length measuring system and I'm using a industrial rotary encoder as the sensor. A have decided to use an Arduino external interrupt for connect the encoder. But, Encoder will ...
0
votes
0answers
16 views

Moving timer-related code into a separate file causing timing inconsistencies?

I have written the following code, attempting to re-implement the Arduino micros function: main.c #include <avr/interrupt.h> #include <stdbool.h> #define CLOCK_CYCLES_PER_MICROSECOND (...
2
votes
0answers
450 views

Arduino nano clone problem with interrupt on falling edge on pin 2

I've s 1Hz square wave coming from a DS1307 SQW/OUT pin going into pin2 on the Nano that is set up as input with internal pullup enabled. I've set up the interrupt on falling edge but I can't get the ...
0
votes
1answer
36 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
116 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
0answers
27 views

MPU-6050 Interrupt Sample Code

does anyone know where I could find some working code the demonstrates how to use the interrupt pin on the MPU-6050? My goal is to be able to shake the sensor in order to trigger an interrupt which ...
0
votes
0answers
43 views

Using Sleep with Interrupts

I have 2 doors closet, that I want to lit when door is open. I use 2 prox sensors to detect state, an Arduino Pro mini, and 2 led strips. I use same code and hardware ( minus not needed doubled ...
0
votes
1answer
327 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> #...
0
votes
1answer
21 views

ISR definition causing boot loop?

I am trying to compile and upload code to an Arduino Uno from the command-line, however I seem to be experiencing an odd issue. When I compile this code: #include <avr/interrupt.h> #include &...
0
votes
1answer
27 views

Arduino Mega - Enabling CTC mode disables timer

I'm trying to use timer3 on an Arduino Mega 2560 in CTC mode. However, enabling CTC disables the code entirely. Here is the function I call in setup() to setup the times. void SetupInterrerupt() { ...
1
vote
2answers
281 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....
0
votes
1answer
44 views

Passing variables for a PID in an interrupt

I'm needing to pass variables from my timerIsr() function to my loop() function. I have little experience with the Arduino language, I'm mostly familiar with Python so this has been quite difficult ...
4
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
2answers
239 views

coding problems

I'm working on a Arduino controlled solenoid motor project that I found on Instructables. I have been able to piece together what I think is most of the code but I'm getting some syntax errors and was ...
0
votes
0answers
47 views

where is avr\interrupt.h on a Windows installation?

I'm trying to move from the Arduino IDE to Visual Studio Code. I have a program that uses interrupt.h #include <avr/interrupt.h> but it's not being found because it's not on the include path. ...
0
votes
1answer
264 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
1answer
234 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() { ...
0
votes
1answer
393 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
1answer
631 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 ...
1
vote
1answer
619 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
225 views

Triggering an SPI transfer with an interrupt in Arduino Due

I have a DDS that is controlled by an Arduino DUE, loop() waits for Serial commands and based on them calls one or another function that sets the DDS's frequency, phase, amplitude etc via SPI. In ...
3
votes
2answers
394 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 ...
0
votes
1answer
190 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 ...
2
votes
1answer
651 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
1answer
55 views

Measure cycle count and time of Digital Input

I am currently working on a project which is read a digital input signal from a machine. The machine operation is as below: when the mold close, the machine gives the "HIGH" signal, when mold is open ...
0
votes
3answers
466 views

Is there any way to use the serial port as an interruption source?

I have and sketch made for reading a temp/hum sensor once every ten seconds aprox. However, I want to introduce an interruption source to send from my keyboard a magic word to make the sensor be read ...
0
votes
2answers
44 views

Interrupt triggering using DHT-11

I am new at arduino. I want to write a sketch that would print the message if the temperature grows greater than 30 C. Here is my sketch can you please tell me what's wrong with it #include "DHT.h" #...
0
votes
2answers
69 views

Reading inside critical sections from ISR

Is it necessary to protect reads of volatile variables in critical sections when using interrupts? Or are critical sections only required when concurrently writing variables? Here is an example of a ...
-1
votes
1answer
70 views

Enable and disable individual interrupts

I am working on timer interrupts and external interrupts. for external interrupts I understood the functions like attachInterrupt. detachinterrupt for individual interrupts ,noInterrupts() and ...
0
votes
0answers
42 views

Arduino stuck when I disable Timer 2 Interrupt

#define TIM2_EN() (TIMSK2 = 0x02) #define TIM2_DIS() (TIMSK2 = 0x00) //HEART SENSOR // Include Libraries #include "Arduino.h" class PulseSensor { public: static void begin(int pulsePin); static ...
0
votes
1answer
77 views

How to use one button with interrupt to enable and disable sleep mode?

I have written a program for a kitchen timer. The timer uses just one single rotary encoder with a push button on its axis. It has modes for counting up and for counting down. After counting down it ...
1
vote
1answer
47 views

Force TCNT to stay below OCRxA on ATmega328P

I'm using a timer and the TIMERx_COMPA ISR to generate a signal in "the background". This ISR is triggered when the timer reaches a certain value (OCRxA), which in turn can be changed by the user. ...
3
votes
1answer
5k views

How to generate hardware interrupt in mpu6050 to wakeup arduino from SLEEP_MODE_PWR_DOWN mode?

I am using Arduino UNO and has kept in SLEEP_MODE_PWR_DOWN mode & want it to wakeup using MPU6050 hardware INT pin (which should send a signal when MPU is in motion). I have used the article https:...
0
votes
0answers
62 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 ...
1
vote
1answer
85 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 ...
0
votes
2answers
117 views

Coin recognition using Coin Accepter in Arduino Uno

I'm working on a vending machine project and I'm using CH-926 and an Arduino Uno for that. I've already set the coin accepter for different number of coins and respective output pulses. I'm unable to ...
2
votes
1answer
80 views

Cannot set MOSI pin low even after ending SPI

I'm building a battery operated device and must shutoff MOSI pin during sleep because it leaks current through the SD card if I don't (about 400 µA). Problem is, it won't stay off. I've looked at ...
2
votes
2answers
7k views

Arduino Mega 2560 interrupt pins and port mapping with rotary encoder

I am trying to use port manipulation in interrupts to read a rotary encoder. I found code for a Uno, so the port call for pins 2 and 3 are different. I think on the Mega they are PORTH3 and PORTH4 ...
0
votes
1answer
36 views

Converting code for ATTINY85 to ATMEGA2560. Pin change interupts

I have code that compiles correctly for an ATTINY85 board using the ARDUINO IDE but I don't have an ATTINY85 board. I have an Arduino Mega ATMEGA2560 and when I select this board in the Arduino IDE ...
2
votes
1answer
95 views

attiny85 reset itself instead of wakeup procedure

I have a digispark attiny85, and I am using SLEEP_MODE_PWR_DOWN to sleep, and wake-up with external interrupt on pin2. I am trying to count number of interrupts received with the code below. Problem ...