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.

64 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
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
1answer
703 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 ...
2
votes
0answers
455 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 ...
2
votes
0answers
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 ...
1
vote
1answer
92 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
0answers
38 views

Arduino Swissflow Meter

We've hooked up a Swissflow sf800 flow meter to our Arudino Uno. The system works, our interrupt callback is triggered and as water flows through the metre, it counts up. The issue is, that the pulse ...
1
vote
1answer
664 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 ...
1
vote
1answer
147 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 ...
1
vote
0answers
115 views

Interference in readings

I have an project which control a heat exchanger. I read 4 temperature sensors DS18B20, a distance with HC-SR04 Ultrasonic Sensor, and a flow with YF-S201 (with attach interrupt). I can turn on and ...
1
vote
0answers
639 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 ...
1
vote
0answers
327 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
0answers
52 views

Serial Write fails to send when Motors moving

I have an unusual bug with the code I have written for my rover V2 robot. I have a raspberry pi running some computer vision code written in opencv tracking an object doing the heavy processing. ...
1
vote
0answers
190 views

attachInterrupt HIGH

I'm trying to understand the implementation of attachInterrupt. For LOW, CHANGE, RISING and FALLING it seems simple enough; it sets some chip-specific registers and stores the given callback in ...
1
vote
0answers
294 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 ...
1
vote
0answers
118 views

Arduino Record pulseIn

I am currently working on a project which requires me to record IR signals. (I realize there is a library available for doing this but I want to learn how to do this myself). I tried using a simple ...
1
vote
0answers
707 views

Interrupt for traffic light

I have mini project which is Emergency Traffic Light for Ambulance, police etc. What I am try to do is when emergency traffic light go through first sensor 1 (in this code I just using button, “SA”), ...
1
vote
0answers
31 views

vrdude stk 500 not responding error inspeed control of dc motor using arduino uno board .how to solve this issue

vrdude stk 500 not responding error inspeed control of dc motor using arduino uno board .how to solve this issue
1
vote
0answers
450 views

Interrupts detach

I need to stop 1st interrupt from 2nd interrupt till 2nd interrup finish work... How can I do that? Here is my 2nd interrupt: void CHECK_IR(){ detachInterrupt(0); if (irrecv.decode(&results))...
1
vote
0answers
530 views

Motor shield causing problems with interrupts?

I am making a controller for a model railway turntable and I need to control a single DC motor and read a hall effect sensor. I have the hall effect sensor connected to pin 2 on my Uno (since 2/3 are ...
1
vote
0answers
839 views

Understanding types of timer interrupts

I'm learning this note about timer's api on Arduino Due. Interrupt can be attached with the next function: void tc_enable_interrupt( Tc * p_tc, uint32_t ul_channel, uint32_t ...
1
vote
0answers
675 views

ADXL345 Arduino UNO Activity Inactivity interrupt

I have DATA_READY, Activity and Inactivity interrupts mapped from INT1 to INT0 on the arduino. DATA_READY works fine, the problem is Activity and Inactivity are always set to 0 in the INT_SOURCE ...
1
vote
2answers
294 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
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
0answers
9 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 ...
0
votes
0answers
15 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
25 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
25 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 ...
0
votes
1answer
36 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
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
48 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 ...
0
votes
0answers
37 views

Why does my TFT keep turning white after moments?

Alright, seems there is something wrong I am doing that I don't understand. Before I start explaining, my question is different than this white screen question. First of all my TFT ST7735 is working ...
0
votes
0answers
39 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 ...
0
votes
0answers
46 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
17 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 (...
0
votes
0answers
39 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
47 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
0answers
71 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
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
154 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
43 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
0answers
82 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
0answers
95 views

Arduino Pro mini does not wake up after a few interrupts from DS3231

I hope someone can help me. I'm building a GSM water level meter that runs on solar power, using an Arduino pro mini, DS3231 RTC, JSN-SR04T - ULTRASONIC SENSOR, SIM800L along with a DFrobot DFR0535 ...
0
votes
0answers
34 views

Arduino SPI ISR

Is there any way to trigger a ISR after a SPI transfer is complete? I am trying to send messages from one of three LORA radios and have the other two read the message. I am using the Radiohead (RF95) ...
0
votes
0answers
271 views

timer interrupts on an esp8266

Folks. I'm working on an ESP8266 and keen to switch to using: an object approach -> sorted; physical interrupts on the hardware pins -> sorted; timer interrupts -> driving me crazy! My problems are ...
0
votes
0answers
117 views

Problems reading Ultrasonic Sensor and starting Stepper Motor

I have a problem with my Stepper Motor and Ultrasonic Sensor. I want to have the Sensor reading the distance, and when it is smaller than 20, it tells the Stepper Motor to stop. I can read the ...
0
votes
0answers
175 views

Encoder code using interrupts design question

I have an Arduino Mega 2560, an Omron Optical encoder with an Index (360 steps), a 60 led NeoPixel ring (no Clk wire) and another Arduino Uno. Here is my question, I have some code written that works ...
0
votes
0answers
292 views

ATTiny85 arduino interrupt

i would like to know why my code running on the ATtiny85 1Mhz not wake up after the interrupt. I use the ATTiny Core. #include <avr/sleep.h> // Sleep Modes https://goo.gl/Mm7wuk #include &...
0
votes
1answer
230 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
1answer
369 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
295 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 ...