is there any easy way to trigger interrupts via external pins. i have three pins that i would lke to trigger the same interrupt on change. How would i do this?
external interrupts
(3 posts) (3 voices)-
Posted 5 years ago #
-
I don't know if it is supported yet, since I can't find it documented. But there is in the source ( hardware/leaflabs/cores/maple/ext_interrupts.[ch]). The following sketch seems to work
#define LED_PIN 13 #define INT_PIN 1 void setup() { pinMode(LED_PIN, OUTPUT); pinMode(INT_PIN, INPUT_PULLDOWN); attachInterrupt(INT_PIN, exti_handler, RISING); } // Called when PIN1 goes high. void exti_handler(void) { // Remember the state of the led static bool led_on = false; // Toggle led state led_on = !led_on; digitalWrite(LED_PIN, led_on); } void loop() { // Nothing. }
It only works for digital pin 0-13 though.
Posted 5 years ago # -
Its true, exti interrupts are in there, work, but are undocumented. The docs omission is historically accidental, however we wont push docs in for this feature until we've tested it to our satisfaction. There is nothing worse than documentation that lies! If youre using the exti interrupts and have any success/failure/caveat stories let us know.
Posted 5 years ago #
Reply
You must log in to post.