the atmega168 on the arduino has a timer1 which has input capture capability (see this application note and datasheet for atmega168 for details). using it, it's possible to do the pulse timing in completly in hardware (no errors, no jitter), and having a interupt readout the measured time.
here's the code:
unsigned int serinp[8]; //servo positions
void setup_timer1(){
//disable all interupts
T…