Code not staying in arduino uno HELP

Hi, this issue has completely halted my progress in a project (modifying an RC car to make it autonomous). when I plug in the arduino and upload the code, the code works and the vehicle does its thing with a push of button. Once unplugged from computer, code magically disappears from arduinio uno and so the vehicle doesnt do its thing when I push the same button. This is really weird as the arduino was working better before.

I cant be walking the vehicle like a dog with my laptop in my hand when the time comes :frowning_face:

Hi @shileirichards

When you plug your arduino into your PC again, the code is no longer in the arduino?

RV mineirin

when plugged back in it works again, no upload needed

Hi @shileirichards

Now then give more details of your project:
How is powering the arduino when in the car:
Batteries, batteries, what kind, what voltage?
Which pin on the arduino is connecting this power source?

Post an schematic of your freehand project.

RV mineirin

Extremely unlikely. You do have a problem with powering the board, though. If you post a useful description of your project, you might get help.

there is a 9V battery and 7.5V battery (5 1.5Vs). the 7V battery (800mAh Ni-Cd Battery; amazon says 6v but I measured 7 with a multimetter) is for the two motors (one is a turning mechanism while the other makes it drive forward or backward. The L293D is where the 7V and motors are connected. 9V battery (POWERFULCELL Extra heavy battery Samxiang) is every thing else, the LED that is suppose to turn on at the start and then off when the driving is done, the servo motor that comes on at the end (its suppose to push a ping pong ball off but I havent set that up, I just let it turn one way and the other for now), and the Arduino board.

I have had some weird instances where when unplugged, the front motor and servo and led comes on. The servo goes on to infinity a lot of the times

So in the project, I am suppose to go in a rectangular box pattern but its difficult because even though it seems that I am using the same battery as before, the motors act so weak on the ground, the initial acceleration sometimes doesnt work and I would have to lift the car for a second in order to let the car move forward. Sometimes the turn (front motor) is fine but sometimes it doesnt turn enough. This makes it so that everytime I test this vehicle, there is a different out come. And now I can't put it on the ground on its own anymore. Here is what the schematic looks like.

the 9V battery isnt plugged in like that, its directly in the arduino

hi @shileirichards.

This is not a technically "readable" schematic.
A careful analysis is very difficult.
Please post a schematic and not a fritizing.

RV mineirin

I started to look at that 'schematic' but its really unreadable and I got dizzy.

Perhaps draw the schematic on a bit of paper with a pencil and post an image of that so forum members can understand it ?

Hi @shileirichards.
Connecting this way will burn the arduino,
It is connecting 9V on the pin which is for 5V.

RV mineirin

I dont think thats why
mostly because the 9v battery (the plug in too) came with the basic arduino kit and there is no 5v battery. 9V is the standard. Maybe I didn't show it in the schematic properly but this is how it looks in real life:

That's not how you show your scheme,
RV mineirin

What does RV mineirin mean? Could you show me an example? It would be greatly appreciated, thank you for your time.

R Rui
V Viana
"Mineiro" from the state of Minas Gerais BR.
"Mineirinho" affectionate way of referring to the "Mineiro".
"mineirin" way of speaking from the countryside,

RV mineirin

You are connect 9V to a 5V pin. If you are trying to power an Arduino through the 5V pin, it has to be 5V. If you are using 9V, then you must power it through the Jack or the vin pin (though using a 9V isn’t the best option). From the way you have described it, you have destroyed the 5V pin

It is probably OK if you connected the Uno and the 9V battery exactly as shown in this photo:

However, those 9V batteries are for smoke alarms, and won't power an Arduino for much more than 10 or 20 minutes.

1 Like

@shileirichards, your topic has been moved to a more suitable location on the forum.

its probably though the vin pin or jack, as shown in the real picture

"Probably"? Do you mean that you don't know how you connected it?