Arduino behaving differently connected vs disconnected

first off, i would like to apologize if this doesn't fit in the section. i was not sure where to put it and it seemed like it kind-of fit in here.

i am currently in the process of making an autonomous, gps-guided, robot that can also avoid obstacles. i am using an arduino uno.

the problem i am facing is the robot behaves how i want to to when it is connected to the computer which provides it power. but when i disconnect it and run it on a battery it acts differently. it acts as if the new updated code was never put on it even though i have uploaded it.

i was wondering if anyone has had similar trouble or know what i am be doing wrong. i know this is broad and you may need to know more to help. i am new to this and do not know exactly what to put so if you need anything feel free to ask and i will try to answer as soon as possible.

thanks in advance, chad

it acts as if the new updated code was never put on it

As if the Uno had it's program memory erased?

Make sure your supply voltage from the batteries is high enough. I have a duemilanove and it works fine from USB power, but if I connect to batteries, it behaves strangely if the voltage is less than 7 VDC. I was using a 4 AA battery pack and it doesn't provide a high enough voltage for the board to operate properly. With some peripherals it is okay and with others it isn't. A 9 V battery works well for a short time -- not much capacity. Try using a larger battery pack.

yes, it is almost like the memory was erased. but the code that was uploaded before is still there.

and im using a 9v to power everything (a small servo, gps, sensor and the board so i guess i can give everything its own power? i just didn't think that lack of power would cause it to behave completely different.

and im using a 9v to power everything

A nine volt what? A battery? a AC power adaper (wall wart)? What is the current capacitor of your 9v whatever?

To properly power your project you should research the max current requirements of all the components it is using, and only then do you have the proper information (total current demand) to go about figuring out how to power everything. I have do doubt that power (lack of current capacity) is the root cause of your problem(s).

Lefty

When you have your 9v source connected, check the voltage on the 5v pin.