Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 359

Interrupts allow the processor to suspend normal operation temporarily so that a high-priority software or hardware event can be handled instead.

2 votes

Ethernet connection - how to send data from interrupt

You don't, instead you set a volatile flag in the interrupt routine and/or append to a circular buffer and handle the actual sending the next time through in your main loop. …
ratchet freak's user avatar
1 vote

Alternative to a delay so it can be interrupted

Make a statemachine. Take a piece of paper and draw out the order of operation and each time you are waiting you specify what each button will do. So for example each time button 1 is pushed you incre …
ratchet freak's user avatar
1 vote
Accepted

How do I handle multiple interrupts and outputs simultaneously?

No need for interrupts, no messy interrupt based IO. Just a simple loop() where you read the input and if different from last time start playing a new file. …
ratchet freak's user avatar
0 votes

Breaking up for loop with ISR

Turn the loop into a state machine instead. Wrap the entire loop body in a switch. Every time you have a delay(t); make it a target for a case label and replace it with startTimeout = millis(); c …
ratchet freak's user avatar
2 votes

Emergency stop button for arduino mega code and circuit attached

The best option is to convert the delay() based code to a millis() based state machine. That way the code will never block and always be going through the loop and the place where you check wether tha …
ratchet freak's user avatar
5 votes
Accepted

How to set the sampling frequency in Arduino without using a delay

Use the concept of blink without delay. Instead of using delay() to set the timeout you use a timestamp and check micros() against that to see whether your interval has passed: const unsigned long …
ratchet freak's user avatar
1 vote
Accepted

Break loop/restart program at any time

replace each delay chain with a switch statement where each delay is replaced by saving the current millis counter, a increment of the state, a case label for the new state and a if(millis()-timestamp …
ratchet freak's user avatar
3 votes

Calling I2C functions inside an ISR

The better way to do it would be to set a volatile flag in the ISR and handle that in the main loop. This relies on you making sure the main loop never blocks so the flag can be check often. volatil …
ratchet freak's user avatar
3 votes

Interrupts Problem with Flow sensor

A lot of peripheral libraries requires interrupts to be enabled, especially when they use timing or the I2C/SPI pins. Instead of disabling interrupts for the majority of the sketch, what you want to d …
ratchet freak's user avatar
4 votes
Accepted

Arduino continuously reading ADC value using interrupt

reset the resultNumber to 0 after you have written it to serial. and turn interrupts back on void loop () { while (resultNumber < MAX_RESULTS) { } for (int i = 0; i < MAX_RESULTS; i++) { …
ratchet freak's user avatar
2 votes
Accepted

How to stop a loop when using attachInterrupt to catch the change of a button

The key will be to split up playCarMusicStart and instead create a playCarMusicStep that will do just one iteration of the loop and returns. Call it every time in loop() akin to blinkWithoutDelay. In …
ratchet freak's user avatar