I need some confirmation on how to connect an 18m PNP diffuse photoelectric sensor to an Arduino.
I am power the unit via an external 12 volt power supply. The ground between the power supply and the Arduino is shared.
The black wire is connected to pin 8 of the Arduino.
When I read the value of pin 8 and output it to the serial monitor, the values are jumping between high and low (0 and 1) when the sensor is triggered.
Essentially I am looking for a stable high or low reading when the sensor in triggered.