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.

For more information see the tag.

604 questions
10
votes
1 answer

Counting pulses with interrupt

I have been trying to count pulses from a 12,500 Hz square wave to trigger an output. Here's the code I have so far. When the Arduino is reset it prints 315 to the serial over a 25 ms sample. 315 x 40 = 12600. Which seems to me it's working…
Brandon Whosville
  • 103
  • 1
  • 1
  • 5
7
votes
1 answer

Mic input and Speaker output using arduino

I am trying to make a small project. Firstly, I want to record voice using a small microphone(electret) for the time button is pressed and on releasing the button, the speaker of my laptop should output the recorded voice or a speaker attached to…
3
votes
1 answer

Interrupts for analog inputs

I have an Arduino Uno. I've been reading about pin change interrupts, and one vector covers the analog pins. However, is it possible to trigger interrupts using analog pins as analog inputs (not digital)? I actually want to analogRead() a…
whitenoisedb
  • 177
  • 2
  • 2
  • 7
3
votes
3 answers

How many and fast interrupt pin can handle in Uno?

So I am using Arduino UNO to do phase cutting and read Fan RPM. For phase cutting, every half frequency it will triggers interrupts and then arduino will triggers TRIAC. Half frequency(50Hz) is 20ms. And for reading rpm, my fan running at 950rpm or…
Naufal B
  • 57
  • 1
  • 8
3
votes
4 answers

Can an interrupt function call a regular function?

If I want to create an interrupt and have it do something, can this 'something' be written in a regular function that I also use outside of the interrupt?
andrew
  • 173
  • 2
  • 9
2
votes
0 answers

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 register. I have set up the threshold for activity and…
user49395
  • 39
  • 3
2
votes
1 answer

When accessing a variable from an ISR, is a volatile pointer enough?

Let's say I want to modify a global variable from inside an interrupt service routine. I must ensure that any variables I modify are volatile. Does it work to use a volatile pointer to data I want to modify if the data itself is not volatile? In my…
M. Werezak
  • 21
  • 1
2
votes
3 answers

Main loop delay behaviour with interupt

This question is not for a project, I am just trying to understand what happens and why. The sketch below works as expected as long as the ISR trigger is FALLING. The red led in the main loop is blinking, apparently without any disturbance from the…
Rob
  • 21
  • 3
2
votes
1 answer

Reading FAN tachometer/RPM on 4 wire fan using arduino

I am following the wiring and code at https://playground.arduino.cc/Main/ReadingRPM but using pin 9 to read the speed instead of pin 2 and I have added a 10K pull up resistor between pin 9 and +5V as well; I dont see any interrupts firing even…
techniche
  • 198
  • 2
  • 12
2
votes
3 answers

Solution to interrupt Arduino every n seconds

I'm a very beginner with electronics and of course with Arduino. Actually I've been in the software field (.NET) for the past 12 years. I am trying to develop a simple system to run for longer using Arduino Nano. Longer means roughly it could be for…
Sandeep Thomas
  • 141
  • 1
  • 3
2
votes
3 answers

Can I cause breaking the main loop from an interrupt?

Consider this simple approach to make a light work in 3 different modes: on, off and blink: attachInterrupt(buttonVector, switchMode, FALLING); void loop() { switch(mode) { case 0: turnOff(); break; case 1: turnOn(); break; case 2:…
YakovL
  • 153
  • 2
  • 9
2
votes
0 answers

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”), traffic light will be pause and the traffic light…
muhisma92
  • 61
  • 2
  • 9
2
votes
1 answer

digitalPinToInterrupt() doesn't work

I am working on a protection circuit with 2 raindrop sensors which would be hooked onto the arduinos 2 interrupt pins and as soon as they detect water they shut some relays off, turn a red led on and exit() the main program. These sensors I have…
reaverx
1
vote
1 answer

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 = 0x16E3600; Serial.print("hi\n"); if(PORTAbits.RA10…
NaturalDemon
  • 123
  • 4
1
vote
0 answers

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 water counter (showed on an lcd) increase only if…
itajackass
  • 111
  • 1
1
2 3