Hello guys, i am having a problem with the PIN 13, the led that most of arduinos have, i made a code that by pushing a button it will turn on or turn off a led, for the led i used the DIGITAL PIN 22 and for the button the DIGITAL PIN 23. the code works fine but after a while the led (PIN 22) turns off and the led (PIN 13) turns on by 2 seconds and turn off that situation happens time after time. I dont know why happen that...
By the way that problem only happens when i use as a voltage source the arduino's USB cable, when i use a as voltage source a battery it doesn't happen.
I did what you said but it didn't work, the problem isn't the button because i tried with the same code that i posted at the beginning and the LED (PIN 13) keeps turning on and then turning off each 30 seconds, i dont know why do that if i putted in the code digitalWrite(led_2,LOW); i made another code, that keep a led on, just that, but after 30 seconds the led of PIN 13 blink 4 times and then return to keep the led(PIN 53) on its like an interruption, i repeat this only happens when i use as voltage sourcce arduino's USB cable, but when i use my cellphone loader, it doesn't happen. Here is the code:
int led = 53 , led_2 = 13;
void setup(){
pinMode(led,OUTPUT);
pinMode(led_2,OUTPUT);
}
void loop(){
digitalWrite(led,HIGH);
digitalWrite(led_2,LOW);
}
I think it might be the arduino's USB cable the problem or the Arduino's itself but i'm not sure...