CameraInterrupt
Overview
The CameraInterrupt
library allows you to handle external interrupts on an Arduino board with proper debouncing and custom interrupt service routines (ISRs). It ensures that an interrupt is triggered only once during the debounce period, even if the signal on the pin fluctuates.
Features
Interrupt Debouncing: Prevents multiple triggers within a short time frame.
Custom ISR: Allows you to define your custom interrupt handler.
Non-blocking: Does not block the main loop while the interrupt is triggered.
Constructor
interruptPin
: The pin to attach the interrupt to.mode
: Triggering mode for the interrupt (e.g.,RISING
,FALLING
,CHANGE
).debounceDelay
: Time in milliseconds to wait before allowing another interrupt. Default is 500ms.
Methods
begin()
begin()
Starts listening for interrupts on the specified pin.
end()
end()
Stops listening for interrupts on the specified pin.
setISRHandler(void (*handler)())
setISRHandler(void (*handler)())
Sets the custom ISR handler function.
resetInterrupt()
resetInterrupt()
Handles the debounce and re-enables the interrupt if enough time has passed.
handleISR()
handleISR()
Handles the interrupt and ensures the ISR is called only once per event.
Example
License
This library is open-source and available for free under the MIT License.
Last updated