Arduino Uno resets (don't keep its programmation) when power change from USB to battery

Thread Starter

Tainara

Joined Sep 10, 2014
6
Hello.

I need some help, please.

I am having a problem with my arduino uno: after I upload the program to arduino board through usb cable and take it off to power arduino with a 9V external battery seems like it resets, I mean when I connect the battery and arduino is powered again the program uploaded before is lost.

I read a possible reason could be the eeprom cycles reached its limit but I just bought the arduino board I'm using recently and didn't uploaded that much programs on it to reach the limit of cycles.

Maybe because I'm using serial communication can this be interferring?
Well, don't know if it's relevant but that's my code program:
Code:
const int sensor = A1;       // sensor on analogue pin

void setup()
{
  // initialize the serial communications:
  Serial.begin(9600);

  analogReference(EXTERNAL); //ADC takes its reference voltage from AREF pin (3V which is the voltage I powered the sensor)

  pinMode(sensor, INPUT); //A1 as input pin


}

void loop()
{
  // print the sensor values:
  Serial.print(analogRead(sensor));
  // print x between values:
  Serial.print("x");
  delay(10);

}
Does anyone know something I can try to solve it?
 

Attachments

Top