Hi, I'm new to coding and I have somewhat of a very basic understanding of c++. Currently, I'm trying to learn about Arduino but I'm having a little bit of a problem.
You see, when I finished making the contraption for the Arduino (self-driving car kit), I had a code template that I uploaded to the Arduino for testing. It turns out the code had a few flaws on it, so after some tweaking, I finally found out how to fix it. So, I uploaded the new code
The problem here lies in the fact that, when I plugged in the Arduino to my laptop, the code worked just as I intended. But, when I unplugged the Arduino, it went back into using the old code.
I tried resetting the Arduino (both by uploading an empty code before re-uploading the new one, and by pushing the reset button on the board itself), and it somehow still remembered and used the old code. how do I fix this problem?
Find out why your new code behaves like the old code after disconnecting from USB. What's the power supply, how much current drawn by external devices from the 5V line?
USB can provide 0.5A @ 5V, other supplies much less.
If the "new" code runs when powered by USB, then that code is loaded on your Arduino. Prove it to yourself with some serial prints in setup that provide a version number.
Then, "all" you have to do is figure out why the project acts up with a different power supply. How are the AA batteries attached?
Please draw a circuit diagram of your power lines and devices. It's only confusing if you say to connect to a gnd "module" - do you mean gnd connector?
You also can not really power 12V and 5V devices from 4 AA batteries.