I have a 5V and 12V Super rechargeable Li-ion Battery, and I'm trying to power my Arduino with it. It's an emergency because tomorrow I have to present a robot and it doesn't work.
My Arduino is an Arduino UNO R3, I try connecting the 12V power to the barrel plug in the Arduino. It doesn't work.
I try connecting the 5V power from the battery to the USB port in the Arduino. It doesn't work.
However when I connect the Arduino by the USB to the computer, it works!
Could someone please provide some insight to this problem?
My code is this:
int led[5] = { 3, 4, 5, 6, 7}; // Assign the pins for the leds
int leftChannel = 0;
int left, i;
int Valor1;
int Valor2;
int Valor3;
int Valor4;
void setup()
{
for (i = 0; i < 5; i++)
pinMode(led[i], OUTPUT);
}
void loop()
{
left = analogRead(leftChannel);
Valor4 = Valor3;
Valor3 = Valor2;
Valor2 = Valor1;
Valor1 = left;
left = left/5;
if (Valor1+Valor2+Valor3+Valor4==0){
for(i = 0; i < 5; i++)
{
digitalWrite(led[i], LOW);
}
}
else
{
for (i = 0; i < left; i++)
{
digitalWrite(led[i], HIGH);
}
for(i = i; i < 5; i++)
{
digitalWrite(led[i], LOW);
}
}
}
I believe it is the serial communication, I have tried connecting a 10k resistor from RX/TX to GND but it doesn't work.