Connect RAMPS 1.4 Optical Endstop to Arduino Nano [solved]

I connected the signal wire to a digital pin and it works. The signal goes from HIGH to LOW when interrupted.

Thanks for your help.