# Sketch not saving on Arduino Uno R3

**URL:** <https://forum.arduino.cc/t/sketch-not-saving-on-arduino-uno-r3/1206366>\
**Category:** 3rd Party Boards\
**Created:** [January 2, 2024, 11:36pm UTC](https://forum.arduino.cc/t/sketch-not-saving-on-arduino-uno-r3/1206366 "2024-01-02T23:36:41Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![wellyamm](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/wellyamm/32/1029887_2.png) [@wellyamm](https://forum.arduino.cc/u/wellyamm)\
**Post date:** [January 2, 2024, 11:36pm UTC](https://forum.arduino.cc/t/sketch-not-saving-on-arduino-uno-r3/1206366/1 "2024-01-02T23:36:41Z")

</div>

I'm building an automatic plant watering system.

The problem I'm encountering involves powering the Arduino without it being connected to the computer. The sketch runs smoothly when the USB is plugged into the computer, but once I disconnect the USB and power the Arduino with an AC adapter, it doesn't seem to execute the sketch. The AC adapter provides power, as indicated by the ON LED being lit. (The adapter has an output of 9 volts and 700mA)

I've attempted a blink test, and it also encounters the same issue. It seems like the code isn't saving on the Arduino. Any solutions?

---

<div class="post-metadata">

**Author:** ![van\_der\_decken](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/van_der_decken/32/1006976_2.png) [@van\_der\_decken](https://forum.arduino.cc/u/van_der_decken)\
**Post date:** [January 2, 2024, 11:46pm UTC](https://forum.arduino.cc/t/sketch-not-saving-on-arduino-uno-r3/1206366/2 "2024-01-02T23:46:10Z")

</div>

I'd be very surprised if that were the case.

When you've loaded the blink sketch, and it works with USB power, and then doesn't work when supplied with external power, what happens if you disconnect external power and plug the USB back in? Does the LED start blinking again?

---

<div class="post-metadata">

**Author:** ![anon94801460](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@anon94801460](https://forum.arduino.cc/u/anon94801460)\
**Post date:** [January 2, 2024, 11:55pm UTC](https://forum.arduino.cc/t/sketch-not-saving-on-arduino-uno-r3/1206366/3 "2024-01-02T23:55:26Z")

</div>

> [@wellyamm](#):
>
> it doesn't seem to execute the sketch.

It almost certainly is executing, but will stop here, if you have code similar to that shown below (a very common mistake for disconnected systems):

```arduino
   Serial.begin(Baudrate);
   while (!Serial); //wait for connection

```

---

<div class="post-metadata">

**Author:** ![wellyamm](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/wellyamm/32/1029887_2.png) [@wellyamm](https://forum.arduino.cc/u/wellyamm)\
**Post date:** [January 3, 2024, 12:02am UTC](https://forum.arduino.cc/t/sketch-not-saving-on-arduino-uno-r3/1206366/4 "2024-01-03T00:02:51Z")

</div>

If i disconnect the external power and plug the USB back in the sketch works as intended.

---

<div class="post-metadata">

**Author:** ![wellyamm](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/wellyamm/32/1029887_2.png) [@wellyamm](https://forum.arduino.cc/u/wellyamm)\
**Post date:** [January 3, 2024, 12:06am UTC](https://forum.arduino.cc/t/sketch-not-saving-on-arduino-uno-r3/1206366/5 "2024-01-03T00:06:14Z")

</div>

This is the code for the blink test, is the code the issue?

```arduino
int ledPin = 13;

void setup() {
  pinMode(ledPin, OUTPUT);
}

void loop() {
    digitalWrite(ledPin, HIGH);
    delay(1000);
    digitalWrite(ledPin, LOW);
    delay(1000);
}

```

---

<div class="post-metadata">

**Author:** ![anon94801460](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@anon94801460](https://forum.arduino.cc/u/anon94801460)\
**Post date:** [January 3, 2024, 12:08am UTC](https://forum.arduino.cc/t/sketch-not-saving-on-arduino-uno-r3/1206366/6 "2024-01-03T00:08:49Z")

</div>

No problem with that code. If the code successfully uploads, then it is stored in the Arduino.

Some other problem is preventing it from running on external power. Please post a close up, focused photo of your setup, showing how external power is connected.

---

<div class="post-metadata">

**Author:** ![van\_der\_decken](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/van_der_decken/32/1006976_2.png) [@van\_der\_decken](https://forum.arduino.cc/u/van_der_decken)\
**Post date:** [January 3, 2024, 12:12am UTC](https://forum.arduino.cc/t/sketch-not-saving-on-arduino-uno-r3/1206366/7 "2024-01-03T00:12:13Z")

</div>

Then whew, the sketch is being saved. There just seems to be something preventing it from running from external power. Which, if the power LED is on... is still very odd.

---

<div class="post-metadata">

**Author:** ![wellyamm](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/wellyamm/32/1029887_2.png) [@wellyamm](https://forum.arduino.cc/u/wellyamm)\
**Post date:** [January 3, 2024, 12:33am UTC](https://forum.arduino.cc/t/sketch-not-saving-on-arduino-uno-r3/1206366/8 "2024-01-03T00:33:47Z")

</div>

The AC adapter is connected from the wall to the Arduino. The attached images provide close-ups of the connections; I don't know if they are relevant.

 ![20240103_012557](https://europe1.discourse-cdn.com/arduino/original/4X/5/a/f/5afd8055eda836c6c3da84b745cb3c7a2d779400.jpeg)  
 ![20240103_012712](https://europe1.discourse-cdn.com/arduino/original/4X/2/d/9/2d945c1436c23251e0fd2cdde8f6e0e52d6f7934.jpeg)

---

<div class="post-metadata">

**Author:** ![anon94801460](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@anon94801460](https://forum.arduino.cc/u/anon94801460)\
**Post date:** [January 3, 2024, 12:38am UTC](https://forum.arduino.cc/t/sketch-not-saving-on-arduino-uno-r3/1206366/9 "2024-01-03T00:38:39Z")

</div>

What are those other things connected to the Arduino?

Remove them and test the blink sketch again.

---

<div class="post-metadata">

**Author:** ![wellyamm](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/wellyamm/32/1029887_2.png) [@wellyamm](https://forum.arduino.cc/u/wellyamm)\
**Post date:** [January 3, 2024, 12:53am UTC](https://forum.arduino.cc/t/sketch-not-saving-on-arduino-uno-r3/1206366/10 "2024-01-03T00:53:35Z")

</div>

Yeah sorry I was just lazy and didn't take the wires out for the picture, the wires are for the main project. The blink sketch still doesn't work without the wires in.

---

<div class="post-metadata">

**Author:** ![anon94801460](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@anon94801460](https://forum.arduino.cc/u/anon94801460)\
**Post date:** [January 3, 2024, 12:56am UTC](https://forum.arduino.cc/t/sketch-not-saving-on-arduino-uno-r3/1206366/11 "2024-01-03T00:56:18Z")

</div>

It looks like that adapter outputs 9VAC (judging from the ~ after the 9).

If so, the Arduino will not work with it. You need a DC adapter, with correct barrel jack +/- connections. 7 to 9V is advised.

Alternatively, use a 5VDC regulated adapter, and power the Arduino through the 5V and GND pins.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [July 1, 2024, 12:57am UTC](https://forum.arduino.cc/t/sketch-not-saving-on-arduino-uno-r3/1206366/12 "2024-07-01T00:57:08Z")

</div>

Closed on July 1, 2024, 12:57am UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
