ken's trains posted:Don't want to be lazy so looked up NPN operation. If I understand, when beam is detected, most current flows to GRD through sensor. Therefore, transistor is off and emitter would be floating. So maybe a resistor from E to GRD would solve problem?
Correct. When beam is detected, NPN is off, emitter is "floating" so a resistor from E to GRD would solve the problem In this case you should use the regular pinMode (x, INPUT) instead of INPUT_PULLUP. Someone correct me if I'm wrong, but there is no Arduino that supports pinMode (x, INPUT_PULLDOWN).
I realize the NPN circuit is all wired up, but couldn't you just run a jumper wire as shown in purple above? It's OK to leave the NPN as-is with the E disconnected.