Use more than 1 interrupts in arduino mega2560.

Hallo,
I am currently working on a robot car, In the below code I have taken the ppm signals from the RC controller and converted it to values which driver can run the motors on.

I connected thr RC 4 channels to arduino mega 2,3,20,21. to get the values as interrupts but I am able to read the signals from pins 2 and 3 but I am unable to process the interrupts from 20 and 21. I checked all four channels in oscilloscope the ppm signals are working properly but I am not able to read it in the processor.

The main problem here is I can take values from interruptRoutine1 but I am not able to get the values from
interruptRoutine2 and so on, can anybody please let me know is it the problem in the interruptRoutine or should I have to change any timer bits in ISR.

Any help is appreciated

interonly1.ino (4.13 KB)

Never Ever put Serial.print() statements in an ISR. They are slow and they need interrupts to be enabled and interrupts are disabled inside an ISR.

…R

You only attach interrupt handlers to interrupts 0 and 1 (from pins 2 and 3). You can't expect unattached interrupt handlers to be fired.