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
1answer
30 views

Receive socket when in loop arduino (Interupt a while loop with a socket)

I'm currently working on an arduino project. Were the arduino is communicating with a NodeJS server via web sockets. The socket connection is working fine and has no problems. But the problem I ...
0
votes
0answers
30 views

Using interrupts to facilitate time-keeping

I am making a clock on an Arduino Mega using interrupts to facilitate time-keeping. The following is my timer breakdown: Timer0: Used for my calls to millis() which allows me to determine when a ...
0
votes
0answers
34 views

Radio receiver: deep sleep when no byte arrives, and wake up when a byte arrives?

This code works to listen for bytes via radio (with a 433 Mhz receiver module) with the Manchester library and Manchester code, and do an action when certain bytes are received: #include "Manchester....
0
votes
2answers
60 views

Disable interrupts when doing critical things?

I've got a few functions like this that log, or do more critical things like get/save configuration variables. /** Write weather data to csv commit: datetime,minHumidity,maxHumidity,...
0
votes
3answers
30 views

PCINT0, PCINT1, PCINT2, etc. on ATtiny45/85

According to the datasheet: we could think that, if we want to have a pin change interrupt for 3 pins, we have to create multiple instances: ISR(PCINT0_vect){ ... } ISR(PCINT1_vect){ ... } ...
0
votes
0answers
13 views

Sparkfun ESP32 WROOM Thing Plus Deep Sleep & Interrupts codes “marriage” problem

Would like to ask for assistance. Tried several routes. My knowledge is lacking and unable to progress further. I think I am very close to the solution (maybe couple of lines of codes away), but the ...
1
vote
1answer
92 views

How to assign an interrupt to a button press with an ATtiny? (interrupt not fired with my code)

(Here is finally a solution). I'm using the following code on a ATtiny45 to assign an interrupt to a button press (pin #7, PB2, INT0). However the LED doesn't blink when the button is pressed, as if ...
0
votes
3answers
27 views

ATmega328P - Problem using timer 2 for tone generation

I'm simply trying to use timer 2 for tone generation and what I get is a very faint and strange tone (almost like its modulated somehow as there is a "pulsing" to it). Here's my simple code: #include ...
0
votes
0answers
35 views

RadioHead Library and SPI Device (MAX7219) not working together

I am trying to use the RadioHead Library (receiving a 433Mhz Signal) and an LED Matrix (Max7219 via SPI) on the same Arduino Leonardo. Now either one works fine when only it is connecting. But when ...
0
votes
1answer
23 views

Setting a number inside a struct causes timer to misbehave

The following code: struct l{ uint8_t pin; uint8_t sensePin; float brightnessTarget; uint8_t PWMvalue; uint8_t inc; }; typedef struct l led; led* redLed; led* whiteLed; unsigned ...
0
votes
0answers
26 views

Multiple Interrupt Pins Generates Wrong Pulses

On MKR WAN 1300 board I added pulldown resistors to 0,1,4,5,6,7,8 pins to count pulses.I can catch interrupts, but sometimes pulses occur on other pins even though they are not touched. For example, ...
0
votes
1answer
121 views

Laser Controller using Arduino Uno

---> I am trying to create a controller using Arduino Uno that simply detects pulses from a waveform generator mimicking a Laser Machine and then switches between 4 state machines states at the output ...
0
votes
1answer
24 views

When does interrupt get fired

When does the ISR mapped to SPI_STC_vect (SPI transmission complete) get fired? Does it fire after a byte has been received (eight clock cycles) of when the slave select changes back to high to ...
0
votes
1answer
86 views

real-time reading of a quadrature encoder at full resolution with only one interrupt on ATmega328

I want to read a quadrature rotary encoders at full resolution with only one interrupt on Arduino Nano (ATmega328). So I found out that we can use XOR to reach a full resolution: Where pin 3 ...
0
votes
0answers
26 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) ...
0
votes
1answer
49 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
1answer
49 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 ...
1
vote
2answers
53 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
0answers
100 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 ...
0
votes
1answer
77 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
1answer
37 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
3answers
74 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
0answers
67 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 ...
2
votes
0answers
68 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 ...
0
votes
0answers
28 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
2answers
94 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 ...
0
votes
1answer
58 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
45 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
20 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
20 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
40 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
36 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 ...
4
votes
2answers
82 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
1answer
130 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
2answers
43 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) ...
1
vote
1answer
26 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 ...
0
votes
0answers
24 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
2answers
166 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 ...
3
votes
3answers
832 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
1answer
101 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 ...
1
vote
1answer
96 views

analogRead() output oscillates even though the pin is grounded

I'm using Arduino Micro to read from 5 flex sensors and display the corresponding angles to the Serial monitor. I am currently having quite some problems with the oscillating values I am getting from ...
0
votes
1answer
101 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
0answers
47 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
2answers
790 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 ...
0
votes
0answers
40 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
1answer
132 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
3answers
124 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 ((...
2
votes
2answers
60 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
2answers
143 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 ? ...
0
votes
0answers
121 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 ...