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
0answers
28 views

Non-blocking delay (`if (millis() - msec_last > period) {…}`) best practices for production code? [closed]

I've been looking to port a library that uses internally if (millis() - msec_last > period) {...}, outside of the Arduino environment. My ideas are to copy-paste Arduino's wiring.c implementation ...
0
votes
2answers
42 views

Do interrupts block other interrupts?

If I have an interrupt attached to two pins and the handler of the first is still executing when the second interrupt fires, does it: a) queue the second interrupt, b) ignore the second interrupt (...
0
votes
1answer
21 views

Initialising timer interrupt crashes Mega 2560

Below is the entirety of my prototype code, the cycling of pin 13 is what I use to confirm the board is restarting. The board resets continually on this implementation of initialising the interrupt. ...
1
vote
0answers
31 views

How to implementing timer interrupt with a sensor device using A0 and A1 pins

I was wondering if there is a way to program a timer interrupt to collect sensor data at a specific sampling rate? I want to attach two strain gauge sensors to A0 and A1 pins and collect the data at a ...
1
vote
1answer
54 views

seeeduino can-bus shield v2: can't read can bus and write on SD card

I'm using a seeeduino V4.0 and a CAN-BUS shield v2.0 with industrial grade SD card. I'm using the default library given by the wiki of seeed. I've simulate a can bus with two mcp2515. I can read it ...
1
vote
2answers
93 views

ESP8266 and Interrupts - not possible?

I'm planning to use an ESP8266 (Wemos D1 Mini) to use as a software SPI monitor to send over WiFi. As a test, I've done a cut-down sketch that just counts the interrupts, a simple frequency counter. I'...
5
votes
1answer
330 views

ATTiny13 Interrupt Issue

I have recently been working on a project that I had initially been designing with an Arduino Nano, and I was able to create functioning code for my application, but for cost / space reduction I ...
0
votes
2answers
56 views

Code Optimization: Interrupt when a value reaches 0

I have this working program that I wish to improve efficiency as much as possible. It will blink slow, then faster and faster until it restarts. It works, but my main concern is, currently, I am using ...
2
votes
1answer
40 views

Adding a common activation pin to a group of buttons

I'm working on an Uno, which has only two interrupt capable pins, but i need at least three buttons to wake it up from its power saving mode. Is there a way to wire buttons such that, in addition to ...
2
votes
1answer
31 views

Arduino with interrupts enters in a locking state

I am quite noobish with using the interrupts on Arduino and I am facing a strange problem. I am using an Arduino Pro Mini, a light sensor and an RTC module(DS3231) which has set 2 alarms, one at ...
1
vote
0answers
38 views

Can someone check my schematic and code? My Led is not turning on

Led1 is on the left Led2 is on the right The code is making LED1 blink every second but it should also turn on Led2 so that whenever I press the push button it should turn off Led2. But Led2 isn't ...
1
vote
1answer
38 views

what to write instead of delay() in interrupt function?

I was trying to develop a traffic light signal controller . when the button is pressed, the pedestrian green light will turn on faster than before . I used delay() in Interrupt function, But it is not ...
2
votes
2answers
55 views

Why impedance between I/O pin and ground drops when Arduino is not powered

I have a 4KHz 5V pulsed signal connected to Arduino UNO pin2 (ISR). When the board is powered, the pulse is attached to ISR rising edge, and is working as intended. I don't know the output impedance ...
0
votes
0answers
40 views

INT0_vect is slow?

I want to wake up my AtTiny45, but it looks like it needs a few nudges sometimes. I have a pull down button connected to INT0. I made sure INT0 wakes up when the button is pressed, and as soon as the ...
0
votes
1answer
51 views

Arduino to AtTiny change of pin interrupt behaviour?

I have a project which, to save on battery, is put to sleep until an interrupt pin is rising from LOW to HIGH. This works well on Arduino Nano, however the translation doesn't on the ATTiny. #include &...
2
votes
3answers
172 views

How to use ADC interrupt on STM32 blue pill

I'm currently using the STM32F1xx boards from http://dan.drown.org/stm32duino/package_STM32duino_index.json To program my blue pill but I can’t find how to write the interrupt for the ADC. I’ve set ...
4
votes
1answer
140 views

Arduino timer interrupts for PID

I'm working on a robotics project where an arduino nano is acting as the motion controller. I'm trying to use a trapezoidal motion profile generator and PID loop to follow that profile, but I found ...
0
votes
0answers
58 views

#include <stdatomic.h> generates compile errors with no code

Consider the following (non)code example: #include <stdatomic.h> void setup() { // Nowt. } void loop() { // Nowt squared. } This generates compile errors for several lines of code in ...
1
vote
1answer
63 views

For Loop function to iterate through outputs after interrupt

I would like help to continuously loop over my output pins after each sleep cycle. I am trying to increment through each output pin during each successive interrupt. Introducing this myIteration ...
4
votes
1answer
244 views

How to get variable from callback function?

There is a library davetcc / IoAbstraction. The only library working as expected with my rotary encoder. The problem that on rotation I can only see serial output with position data, but I cannot get ...
1
vote
0answers
26 views

Which pin triggered MCP23017 interrupt

This is my first post here, so apologies in advance if I've done something against any forum guidelines! I have a project where I am monitoring multiple switch states with an Arduino using multiple ...
2
votes
0answers
114 views

Wake up from a pin, Sleep when work is done

I have a project which needs to sleep most of the time, and when a button gets pressed, it does its thing which is producing a fading sound wave (using interrupts) until it's time to sleep again. The ...
2
votes
1answer
36 views

Is it possible to detach an interrupt for a certain ammount of time

Hardware: Arduino Uno Software Version: 1.8.13 My sketch has an interrupt service routine that triggers with the rising edge of digital pin 2. What I want to do now is detaching the interrupt as soon ...
0
votes
1answer
79 views

SPI transactions in Arduino

I have a task where I should do SPI transactions in interrupt mode. Means I have to handle data in IRQ handler (both for tx and rx bytes). How should I approach? I have a arduino board (2560) and a ...
0
votes
1answer
49 views

ISR Issue: Arduino Pro Micro

I'm trying to do a small test where I am using the ISR on the Arduino Pro Micro it up from sleep mode. I'm using a Force Sense Resistor (FSR, a resistor that changes it's resistance depending on how ...
0
votes
1answer
129 views

Animation of led strip with ESP32 does not work when WiFi is in use

I am using the ESP32 for a simple project. I know how to animate an led strip using atmega328p with arduino but when I animate it on the ESP32 it does not work that great. It will be nice if I can use ...
1
vote
2answers
115 views

Detecting an incoming 7.875 kHz pulse to use as trigger

I have written a code that detects an incoming pulse (square) of 7.875 kHz to trigger the output High for the entire duration of pulse, and trigger the output low if the pulse is off or not detected. ...
2
votes
1answer
50 views

Timer question: Phase Correct PWM at specific frequency

I am trying to create a sinusoidal wave segmented in 64 Frame, each holding a Duty cycle precisely varying from 0x00 to 0xff. This is for an Arduino Nano. I have trouble understanding the following: ...
2
votes
1answer
356 views

Which Arduinos support ATOMIC_BLOCK?

Is there a definitive list of which Arduino architectures support the ATOMIC_BLOCK() macro, and a list of #defines for each architecture? I've tried searching through the Arduino cores on GitHub to ...
0
votes
0answers
33 views

esp32 pico kit - actual clock speed vs crystal vs max_speed etc

I am trying to understand how the clock speed in the esp32 works. I am running arduino ide 1.8.12 with 1.04 board definition - on a pico kit 4 module . The device datasheet says it has a 40mhz crystal....
0
votes
0answers
64 views

watchdog timer giving me fits on ESP8266, how to find relevant code from Serial output describing the RST?

I've written a pair of sketches for two NodeMCUs to implement a noise meter. The master MCU voltage samples off an opamp's output pin and periodically digests 500 samples at a time into an RMS-type ...
1
vote
1answer
40 views

How to specify a timer's name depending on the chip it will be compiled to?

I need to enable a timer interrupt for a chip, and in the mean time, I am testing the code on Arduino Nano rather than (feed the chip, test the chip)++. So as part of the code I have to TIMSK0 |= (1 &...
0
votes
0answers
38 views

ds3231 rtc module weekly alarm

I have a ds3231 and Arduino UNO and I need to get an interrupt from ds3231 once a week for example every Fridays. I've searched a lot in the internet and forums but did not find any library or code ...
0
votes
2answers
46 views

External Button Interrupt (Digital Pin 3) of Arduino not working

I am trying to execute external button interrupt with Arduino and 16*2 alphanumeric LCD. What I am trying to do is when I press the button then the screen should switch between different options. When ...
0
votes
1answer
94 views

Connect two SD cards to one Arduino board and copy from one to another

I'm trying to connect 2 SD cards to an Arduino Uno board. My first question is: Is it possible to connect two SD cards to one Arduino simultaneously? The second question is: If it is possible to ...
0
votes
1answer
54 views

Arduino using delay in I2C receiveEvent

I have read before that you can't use delay() inside I2C receiveEvent because it is an ISR. What I want to do is as follows: I have a servo connected to my Arduino Uno and I want to control that using ...
1
vote
1answer
61 views

Is it possible to get which pin generated interrupt?

I wrote some code that handles rotary encoder using an interrupt, but I would like to get which pin generated the interrupt, so I'll be able to handle many interrupts in a single method. Something ...
0
votes
5answers
111 views

Simple serial message not consistent (sometimes jumbled up)

I have the following code, it works (most of the time) - yet it's not 100% reliable and now and then will send through a double message on one line or 2 subsequent alpha characters: const byte ...
0
votes
2answers
636 views

Serial Interrupt

I want to create a simple program, that responds to me sending a character over the Arduino IDE console. I am using an arduino UNO. Here is my program: volatile bool MeasReceived=false; ISR(...
2
votes
1answer
108 views

Mega: attachInterrupt on pin 18/19/20/21 not working

Task: I'm trying to create a fan-control with the arduino mega. I'm generating a PWM signal on pin 6 and 7 and want to use interrups to measure the rpm of the fans. Problem: On pin 2 and 3 everything ...
0
votes
1answer
279 views

Running hardware interrupt function on NodeMCU ESP8266, Exception(0) after four iterations, can't disarm interupt function

I've been trying to test the stability and consistency of hardware interrupts on my NodeMCU ESP8266. I'm using the Arduino IDE. This sketch should not require any external circuitry and I think, but ...
0
votes
1answer
414 views

Esp32 external interrupts sometime is missing

In short. ESP32, two water meters (hot and cold). Booth, hot and cold, some interrupts are missed. When i connect ESP32 to serial monitor and watch then all interrupts are detected (about 5-10 minutes)...
0
votes
0answers
36 views

LiquidCrystal swap lines with interrupt

#include <Wire.h> #include <LiquidCrystal.h> int temp; const int rs = 13, en = 12, d4 = 11, d5 = 10, d6 = 9, d7 = 8; LiquidCrystal lcd(rs, en, d4, d5, d6, d7); char Nick[15] = {' ', ' ', '...
1
vote
1answer
75 views

Is my sketch 'thread safe'?

I come from a .Net background, typically I would 'lock' operations on an integer when I have thread-safe requirements. I'm not sure that applies to my sketch here? Could I potentially bypass an ...
2
votes
1answer
117 views

Use ISRs inside a library more elegantly

At the moment I try to make a library which uses attachInterrupt(?,?,RISING) to read a sensor. The article of Nick Gammon on Calling an ISR from a class helped me a lot, but his "Glue routines" get ...
-1
votes
2answers
160 views

Running a motor for a 3 seconds continuously with and without interrupt

I have interfaced a dc motor and IR sensor to my nano. The DC motor is supposed to run only if the IR sensor detects an obstacle. Now, I'm trying to get the motor to turn off if continuously ...
2
votes
1answer
128 views

Arduino Project Interrupt Error?

I have a project to be made i.e. water Billing System using RFID(Mfrc522) on Arduino NANO. There is one difficulty that I haven't been able to overcome. I hope someone could help me out. Project flow: ...
1
vote
0answers
36 views

DS3231 clock module with cascaded FC-16 led matrix modules + Arduino Nano

I am using a DS3231 real time clock module and 4 cascaded FC-16 modules(they are basically MAX7219 led matrices based modules). My goal is to display a timetable, a schedule for a classroom on the ...
1
vote
1answer
180 views

Arduino Nano, DS3231 RTC clock module and 4 cascaded FC-16 led matrix modules

Like I said in the title, I am using a DS3231 real time clock module and 4 cascaded FC-16 modules(they are basically MAX7219 led matrices based modules). My goal is to display a timetable, a schedule ...
2
votes
1answer
104 views

Interrupt every second on ATTiny84 (and sleep the rest)

I'm building a digital watch just like in this post, except I'm using an ATTiny84. However, the ATTiny84 doesn't have an asynchronous Timer2 like the ATMega328 and does not have a power save mode, so ...

1
2 3 4 5
11