I am developing a simple Arduino-based device that is intended to operate completely standalone with no connection to a PC. The device is a fairly straightforward turn signal light controller for motorcycle use. I connect to a PC only for programming the device, testing and troubleshooting.
I have run into a situation: certain parts of the code (having to do with operating a multi-state push button) work properly only when the Arduino is connected to the PC. As soon as I disconnect the device, the pushbutton code stops working properly.
The oddest part is that I have parallel code for a Left pushbutton and for a Right pushbutton. Apart from the Left/Right differences, the code for the two buttons is identical. When the Arduino is disconnected from the PC the Right pushbutton code stops working, but the Left pushbutton code continues to work as it should. When connected, both pushbuttons works fine.
I do have the Serial.begin(9600) command in setup, but I do not use any Serial commands in the code except when I need to troubleshoot something--like now.
I have not included any code because I am looking for general pointers about what might cause this sort of behavior and how to troubleshoot it since when the Arduino is connected via USB, the code works and there is nothing to troubleshoot. Very frustrating.
Thanks in advance for any suggestions.