interrupts()

Description

Re-enables interrupts (after they’ve been disabled by noInterrupts()) Interrupts allow certain important tasks to happen in the background and are enabled by default. Some functions will not work while interrupts are disabled, and incoming communication may be ignored. Interrupts can slightly disrupt the timing of code, however, and may be disabled for particularly critical sections of code.

Syntax

Use the following function to re-enable interrupts in your program:

interrupts()

Parameters

The function does not admit parameters.

Returns

This function returns nothing.

Example Code

The code enables interrupts after disabling them.

1void setup() {}
2
3void loop() {
4 noInterrupts();
5 // critical, time-sensitive code here
6 interrupts();
7 // other code here
8}

See also

Suggest changes

The content on docs.arduino.cc is facilitated through a public GitHub repository. If you see anything wrong, you can edit this page here.

License

The Arduino documentation is licensed under the Creative Commons Attribution-Share Alike 4.0 license.