Go Down

Topic: Attaching interrupts to multiple pins (Read 691 times) previous topic - next topic


I'm trying to measure how long it takes each digital input to go from low to high. Can an Arduino Mega be programmed to have separate interrupts attached to each of its digital pins, to detect a level change? Or would you just constantly read pin values in the main loop() and check for the change there?


Sure, you could use PCINTs on all the pins, set a flag when the interrupt occured.
Have a tight loop running that reads micros( ) when an interrupt occurs, note which interrupt it was, and clear the flag.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.


Read this
then watch this



Go Up