Fixed Arduino code (mysterious subtraction error for pulse widths)