Hello every 1!
The thing happend yesterday.
I was messing up with 2 servos, and buttons.
/*
Arduino Servo Test sketch
*/
#include <Servo.h>
Servo servoMain; // Define our Servo
int button_pin = 4;
int button_state = 0;
int button_pin2 = 5;
int button_state2 = 0;
int servo_place = 5;
void setup()
{
pinMode(button_pin, INPUT);
pinMode(button_pin2, INPUT);
servoMain.attach(10); // servo on digital pin 10
servoMain.write(0);
}
void loop()
{
button_state = digitalRead(button_pin);
button_state2 = digitalRead(button_pin2);
if (button_state == HIGH) {
servo_place += 10;
servoMain.write(servo_place); // Turn Servo Left to 0 degrees
delay(250); // Wait 1 second
}
else
{
servo_place+=0;
}
if (servo_place >= 185)
{
servo_place = 180;
}
if (button_state2 == HIGH) {
servo_place -= 10;
servoMain.write(servo_place); // Turn Servo Left to 0 degrees
delay(250); // Wait 1 second
}
else
{
servo_place-=0;
}
if (servo_place <= -5)
{
servo_place = 0;
}
}
Everything was working fine. After few hours my arduino stopped responding for usb power.
When i connect it by usb cable with external power source connected it looks like it's working fine.
How can I fix it( if possible )?
Thank u!