A baffling problem -- not the standard "won't work without USB" question. Read on. . .
I have a sketch / circuit that involves multiple sensors, LEDs etc. The the sketch will not work without the USB connected, but it does work when the USB is either connected to the computer or to a 5V charger.
The simple answer would be: the Arduino is not getting enough power. But I have eliminated this as being the cause by using an adequate power supply and assuring that the Arduino powers nothing directly, and having a parallel voltage path for the peripheral sensors, etc.
But the sketch still doesn't work. But (strangely enough) it does work when I do the following:
(a) power the Arduino from a brick (Vin pin), assuring a separate voltage/power path for peripheral sensors, LED, etc.
(b) plug one end of the USB cable into the Arduino
(c) plug the other end of the USB into a charger,
(d) I do NOT plug the charger itself into anything!!
In other words: the Arduino is connected via a USB cable into an unplugged 5V charger. No power flowing from the charger to the Arduino.
I have already assured there is no serial RX/TX in the sketch, and I do not use pins 1 or 2. Still doesn't work.
There is something happening when the Arduino sees the unplugged charger. I just cannot figure out what is going on. Can you?
PS: If all I have is the USB cable plugged in with no charger, the sketch does not work.