I have an Arduino, with a Sharp IR sensor connected to it, and code that basically says:
If analog value from Sharp > certain value, turn LED on.
else, turn LED off.
When I plug my Arduino into my computer, and power it via USB, this works perfectly.
However, when I power it by batteries (4 x AAA), the LED is always on, even when there is nothing near the Sharp at all. Can anyone give an explanation of why this happens, or a solution to this problem?