Interrupts

In Maixduino, you can use up to 32 digital pins of the 48 FPIOs as external interrupts.


1. attachInterrupt()

1.1. Description

Set Digital Pins With Interrupts.

1.2. Syntax

attachInterrupt(pin, ISR, mode)

1.3. Parameters

pin: the pin number

ISR: the ISR to call when the interrupt occurs; this function must take no parameters and return nothing. This function is sometimes referred to as an interrupt service routine.

mode: defines when the interrupt should be triggered. Five constants are predefined as valid values:

  • LOW to trigger the interrupt whenever the pin is low,

  • CHANGE to trigger the interrupt whenever the pin changes value

  • RISING to trigger when the pin goes from low to high,

  • FALLING for when the pin goes from high to low.

  • HIGH to trigger the interrupt whenever the pin is high.

1.4. Returns

Nothing


2. detachInterrupt()

2.1. Description

Turns off the given interrupt.

2.2. Syntax

detachInterrupt(pin)

2.3. Parameters

pin: the pin number of the interrupt to disable

2.4. Returns

Nothing

results matching ""

    No results matching ""