Arduino Analog inputs not operating correctly when usb cable unplugged

I have an arduino uno with a sparkfun proto shield kit. I am using the analog inputs for pushbutton capture. Pushbuttons trigger LEDS connected to digital outputs. Project works fine with the USB cable connected. After removing the USB cable, the pushbuttons seem to trigger multiple lights randomly. Any ideas?

I am using the analog inputs for pushbutton capture.

Why? Switches are digital devices. They are either on or off.

After removing the USB cable, the pushbuttons seem to trigger multiple lights randomly. Any ideas?

First thing I'd want to do is look at your code. Second thing I'd want to do is look at your alternate power supply. Hopefully, it's not a dinky 9V battery. Third thing I'd want to do is look at a schematic of your wiring.

What's so funny about a 9volt battery? :slight_smile:

My bet is that the answer lies within your schematic/wiring...

johnnyonthespot:
What's so funny about a 9volt battery? :slight_smile:

It sucks for powering anything but very low current devices.

mmenne1:
After removing the USB cable, the pushbuttons seem to trigger multiple lights randomly. Any ideas?

How are you buttons wired? Are you using resistors to pull-up or pull-down the INPUT pin when the button is pressed? Elaborate here and, as Paul suggests, post your code.