Translated code and fixed a little bug

I couldn't see the last pulse length; there was 'numberpulses-1' in the
for that now is only 'numberpulses'.