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
-1 votes
0 answers
34 views

Interrupts while delay() [closed]

I have a small code that makes heavy use of delay(). That is because it is using the tone() function to generate some music - and to make it work you also have to use delay(). The code works fine. ...
  • 1,339
1 vote
1 answer
72 views

Checking a thing about interrupts

If I disable interrupts (for example noInterrupts or cli) and enable them (interrupts or sei for example) later, would interrupts which would have executed in the window in between fire by the ...
  • 33
0 votes
0 answers
20 views

Power saving and pc interrupts on ATMega324PA

I have an ATMega324PA and I want to power down and only wake on CAN receive (working on int 0 successfully), on a schedule, on pcints on 6 digital inputs, and on serial receive - either serial0 or ...
  • 11
0 votes
1 answer
48 views

ATTiny88 missing pulses - maybe

I have been given to understand the ATTiny88 is very similar to the Arduino Uno / ATMega328 MCU. There does not seem to be a tag for the ATTiny88, so that is why I chose the tags I did. I do not ...
1 vote
1 answer
32 views

Is ESP8266 dropping an interrupt?

I want to use interrupts on my ESP 8266 to monitor the digital outputs of a power meter and water meter. The idea is to increment a counter in the ISRs and at some point to take the value of the ...
0 votes
1 answer
115 views

DS3231 with Arduino Nano for Timing precision

I am in need to synchronize two separate circuit boards working with Arduino nano. The need is to activate one relay using Arduino-1 after 45 min and another relay using Arduino-2 after 45.36 seconds. ...
  • 173
2 votes
2 answers
91 views

Arudino receiving interrupt command BEFORE entering sleep mode causing it not to receive any interrupt commands in order to wake up

I've written code for an Arduino Nano that when a button is pressed, it sends an IR command. It is set so that if no button press has been received for a period of 10 seconds, it will enter sleep mode ...
0 votes
1 answer
89 views

Arduino nano timing precision

How precisely can an Arduino nano be timed? The project I am working on needs two Arduino nano to work synchronously. Arduino one have to activate a relay after 2700 sec and Arduino two have to ...
  • 173
-1 votes
1 answer
95 views

Modify global enum from interrupt fuction

I have a global enum. enum Modes { ModeOne, ModeTwo }; enum Modes currentMode = ModeOne; I also have an interrupt function, that on a given event should change the enum value. void ...
  • 1,339
-1 votes
3 answers
313 views

Interrupt on button press + debouncing

I want to have an interrupt function executed whenever a button is pressed. The button is connected to pin 2 and the GND. Therefore, the pin is turned to LOW whenever the button is pressed. In ...
  • 1,339
1 vote
1 answer
28 views

Fubarino (microchip pic32mx), Second timer interrupt is not firing

volatile uint32_t counter_timer = 0; void __USER_ISR myISR() { counter_timer++; clearIntFlag(_TIMER_3_IRQ); } void __USER_ISR myISR_timer_four() { clearIntFlag(_TIMER_4_IRQ); TMR4 = ...
2 votes
1 answer
187 views

Attiny timer interrupt does not make an interrupt every 1000ms

I'm making a stopwatch using an attiny85, the idea was to use the timer interrupts to count the seconds my theory was: since I set the Attiny85 to run at 1Mhz, I can use a presale of 1024; 1000000 / ...
-1 votes
1 answer
49 views

Share interrupt service between class

I would like to share interrupt routine between class. I followed this tutorial. But I need to call a member function in callback function, I have the issue : This is my code : Timer.h static void (*...
  • 3
-1 votes
1 answer
206 views

Stopwatch stop/start button and reset

i am trying to make a stop watch with a stop/start button and a reset button i have made this #include "RTClib.h" //Setup the Real Time Clock, DS3231 RTC_DS3231 rtc; const byte SQWinput = 2;...
-1 votes
1 answer
133 views

`noInterrupts()` causes the arduino to no longer appear in ports

Minimal working example: void setup() { // initialize digital pin LED_BUILTIN as an output. noInterrupts(); pinMode(LED_BUILTIN, OUTPUT); } // the loop function runs over and over again forever ...
  • 111
0 votes
2 answers
100 views

External Interrupt not working on 3.3V atmega168

I made a 3.3V board and I've put both atmega328p (that I pulled off of a 3.3V pro mini), and an atmega168 that I bootloaded (using USBtinyISP whilst selecting board "Arduino Pro or Pro Mini" ...
-1 votes
1 answer
28 views

Interrupt is sporatic, potentially after 220Hz or so

Background although likely not needed: I am recieving a frequency on the destination side of a opto isolater. A fan trips a hall effect sensor, and grounds a circuit which lights the opto. On the ...
1 vote
1 answer
86 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 ...
-1 votes
2 answers
70 views

Can't 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 ...
1 vote
0 answers
69 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 ...
3 votes
2 answers
1k 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); } ...
0 votes
1 answer
64 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 ...
  • 231
1 vote
1 answer
347 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)...
  • 113
1 vote
1 answer
97 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 ...
-1 votes
1 answer
125 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, ...
  • 170
2 votes
1 answer
228 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,...
  • 163
1 vote
0 answers
60 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 ...
0 votes
1 answer
78 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 ...
  • 183
3 votes
0 answers
135 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 ...
  • 31
1 vote
2 answers
121 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.. ...
  • 11
1 vote
1 answer
240 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 ...
1 vote
1 answer
93 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 ...
2 votes
1 answer
67 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 ...
-1 votes
1 answer
46 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*" ...
1 vote
1 answer
71 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, ...
2 votes
2 answers
513 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 ...
3 votes
2 answers
730 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 ...
  • 173
2 votes
0 answers
232 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 ...
  • 173
3 votes
1 answer
146 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 ...
  • 173
1 vote
1 answer
71 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>...
1 vote
0 answers
101 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 ...
1 vote
1 answer
80 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 ); ...
1 vote
1 answer
141 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 ...
1 vote
2 answers
322 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 ...
  • 113
1 vote
1 answer
192 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, ...
  • 13
0 votes
1 answer
78 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 ...
0 votes
1 answer
43 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 ...
  • 103
1 vote
1 answer
39 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. ...
  • 31
0 votes
2 answers
811 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); ...
  • 3
1 vote
1 answer
138 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 ...
  • 123

1
2 3 4 5
12