Go Down

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

Cerin

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?

CrossRoads

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.

DuaneB

Read this
http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html
then watch this
http://rcarduino.blogspot.com/2012/04/servo-problems-part-2-demonstration.html

Rcarduino.blogspot.com


Go Up