user70057: I am having trouble getting my Arduino Uno to run my code when I disconnect it from my computer.
I have a 9V battery to power it and it is turning on, however, it is not doing anything at all. What can I do to make it run the code when it is using the battery and not connected to the computer?

user61722: Use a fresh 9V battery, or better, a proper power supply or some AA batteries in series, just to make sure the power supply isn't the problem.
BTW on some Arduinos (though probably not yours) it often pays off to check if there is a while (!Serial); or some such in the code. If there is, it is blocking code execution until the USB is connected and the serial monitor is opened.

70057: <p>I am having trouble getting my Arduino Uno to run my code when I disconnect it from my computer.</p>
<p>I have a 9V battery to power it and it is turning on, however, it is not doing anything at all. What can I do to make it run the code when it is using the battery and not connected to the computer?</p>
 61722: <p>Use a fresh 9V battery, or better, a proper power supply or some AA batteries in series, just to make sure the power supply isn't the problem.</p>
<p>BTW on some Arduinos (though probably not yours) it often pays off to check if there is a <code>while (!Serial);</code> or some such in the code. If there is, it is blocking code execution until the USB is connected and the serial monitor is opened.</p>
