Sensor RPM without Interrupts

Hi… I’m working a week ago with Arduino, and I am implementing a speed sensor for 4 bicycles to send the signal to Adobe Flash and connect to a game … The Atmega328 has only 2 External Interrupts and I need 4, so I’m trying to implement Polling … the maximum frequency for receiving data from a single cycle is 50Hz (20ms) … the question is: Polling is feasible to work with these speeds, or I will get the Arduino Mega has 6 external interrupts? hehe … Thank you very much if anyone can help me with this…

Be aware the atmega328 has the ability to set its other pins as interrupts, called the "PCINT" interrupt system I think... I've read somewhere that somebody wrote a library to use these, but I don't have the link off hand.

pin change interrupts indeed

you need to read this - -


I didn’t write the pinchangeint library or contribute in anyway but here is a write up on the library -

And an example of using it to read multiple signals which you could adapt to your application

Duane B

For fastest response for pin change interrupts (especially if you only need another two) choose pins on different "groups". (eg. PINB and PINC).

Then you can configure an interrupt handler for each one with minimal testing needed as to exactly which pin caused the interrupt.

More info here:


Thanks everybody... I have been reading the links you sent me and I'm trying to make a 'fusion' of all the info ... this weekend I will work hard and tell them how I was ... (write in English is still difficult for me, and I translate some things on google, but I hope you mean, lol)

We understand it perfectly (otherwise we will just ask)