The switch gives a high level output without obstruction, and a low output level when there are obstacles in front of it
How would one see the level ? Especially if it were an open collector...
Sure, my "voltage meter reading" was just a guess, inspired by my own approach (most likely) as a newbie myself.
there's something that you can measure this way, chances are good you can simply supply it to analogRead or digitalRead as you like.
what really is required to determine that is a datasheet for your device.
Internet is not only for porn
, you find every datasheet there, too. Awesome.