UKHeliBob:
There is no algorithm. The code reads the state of each input pin.However, I should point out that the code I posted, whilst showing the principle of reading several inputs in quick succession is flawed. Instead of detecting that an input is HIGH it should actually detect that the input has become HIGH since the last time that it was read. This is not difficult to do but first you need to understand the principle of reading several inputs in quick succession.
External interrupts are detected on specific pins of the Arduino. Pins 2 and 3 on a Uno, for instance.Pin Change interrupts can be used on most digital pins but there is more work (programming) required to detect that a pin in a group of pins on a port has changed state and then to determine exactly which pin has changed state. Did you look at the example on the page linked to in reply #7 ?
Okkk! A hell lot of thanks there!! I actually read what was on that article regarding the pin change interrupt. As far as the inputs of sensors in succession is considered, I will leave that still at the moment. But I browsed through some ways of using pin change interrupt and I actually got a way by doing slight modifications in the code for basic pin change interrupt (You can say I used a cheat sheet :P).
I was actually looking for any way by which I can use other digital pins in the same way as pins 2 and 3 are used (interrupt 0 and 1). Although it worked out that those two are the only external interrupt pins available but using pin change interrupt worked anyway!
Can you still help me a bit by telling how can I incorporate the code for both external interrupt pins and pin change interrupt in the same program ( so that I can use 2 sensors at the external interrupt pins and 1 at the pin change interrupt).
Thank you so much for your help!