Playing videos alternately

Hello! I am trying to play two videos alternately depending on the distance measurement of the ultrasonic sensor. This is my first time using both Arduino and processing, and I’m lost in setting values properly. I don’t know why processing is getting the wrong measurement from the serial list. It shows random numbers that don’t match the ones from Arduino’s serial monitor.

Random numbers from the port probably means you’re not getting actual sensor data, just noise.

I’d suggest testing step by step. First debug the sensor and make sure you’re getting a consistent signal.

One piece at a time!