Parking Sensors Hacking, How to analyze the signal?

Hello everybody!
This is my firs contact to arduino, looking forwad to have a lot of fun with it :wink:

May problem: I tried to rebuild this Project:
and it works fine to the point of getting the bits into the arduino (mega), but the serial output is a little messed up, as you can see on the pictures.

The incoming datastuchture is Pulse-width modulation, 3 byte long, first byte contains the sensor adress, second one the distance measured by the sensor in cm and the last one contains the inverted information of the 2nd one.

Eery information is transmitted twice (AABBCCDDAABBCCDD…)

Mayby somebody can help me getting the bits organized :wink:

Best regards from Aachen, Germany

serial_output.txt (5.54 KB)

Sensor1.ino (1.81 KB)