connecting the ground worked, but after testing a little bit while, the strangest thing happened, everything just stopped working again. I can hear a low hum from the servo, but that's it.
here's my code:
#include <Servo.h>
const int servoPin = 3; // control pin for servo motor
Servo myservo;
int angle = 90;
void setup()
{
myservo.attach(servoPin);
myservo.write(angle);
Serial.begin(115200);
}
void loop()
{
if (Serial.available() > 0) {
int moveServo = Serial.read();
//1-0,2-30,3-60,4-90,5-120,6-150,7-180
if (moveServo == '1') {
angle =0;
}
if (moveServo == '2') {
angle =30;
}
if (moveServo == '3') {
angle =60;
}
if (moveServo == '4') {
angle =94;
}
if (moveServo == '5') {
angle =120;
}
if (moveServo == '6') {
angle =150;
}
if (moveServo == '7') {
angle =180;
}
Serial.print("Angle: ");
Serial.print(angle);
myservo.write(angle);
}
}
I checked the power src for the servo, and its still 5v no problems, and the connections all seem fine...