How best to wire a 6-36 vdc photoelectric switch to an Arduino Uno

@jremington whoops! I had to read up on pullup resistors and your suggestion makes sense to me now. I hope we have stumbled on the answer to my real problem which has been an erratic photoelectric switch. I’m going to mark this discussion solved.

The solution is as follows: When monitoring for an input signal (in my case a photoelectric switch), you must consider the distance between the two devices (and the wire sizing). For shorter distances you might be able to use the internal pullup resistor (by defining the Arduino pin as INPUT_PULLUP). If your signal is flaky, the distance may be too great between the devices and you may need to use an external pullup resitor instead (Arduino pin to be defined as INPUT in this case). I’ll leave the explanation of resistor sizing to the experts. @jremington was kind enough to offer this example for the wiring. My revised wiring sketch is also shown below.