I wrote some code on the Arduino and it works perfectly fine when powered by the USB. However, when I switch to 9V DC, the sketch does not run. I have tried various things including putting a 10k ohm resistor between RX and TX (Digital 0 and 1). I tried to connect both of them with a simple wire (no resistor). I finally tried connecting RX to ground both with and without a 10k ohm resistor in the path.
I should note that I have an arduino uno, so I have been following the information from Vilros's website. However, the advice hasn't worked for me and I do not know what to try now.
Can anybody suggest how I may get my sketch on the arduino to work when the arduino is not connected to the computer?
Edit, more information: As far as I've tested, the sketch is fairly robust. The board seems to be running on all of the 9V power (when I disconnect the USB it remains powered on). I do not have it connected to the Vin pin though, I have the 9V connected to the DC power supply outlet. The battery is perfectly new.