An inductive sensor can detect metallic objects without touching them. 


A retro-reflective light sensor can detect objects passing throught a light beam.

A resistor is a passive two-terminal electrical component that implements electrical resistance as a circuit element. Resistors act to reduce current flow, and, at the same time, act to lower voltage levels within circuits. Every resistor has a specific electrical resistance which limits the flow of electrons though a circuit. A resistor can be compared to a valve or tap in a water line. The more you close the valve, the higher the resistance and the less pressure there is and the less water flows.