So have been having trouble with small servos. when I plug the VCC and GND line without signal sometimes the servos will just spin 360 degrees non stop. Sometimes they will just move erratically. When I plu the signal cable usually it stops. Has happened on multiple servos.
In the video is another issue. The metal servo moves correctly plus minus starting from 0 degrees with joystick back and forth.
the sg90 servo however starts at around 0 and goes to 170 degrees in one direction. Pushing on the opposite way on joystick causes little or no movement.
//add the servo library
#include <Servo.h>
//define our servos
Servo servo1;
Servo servo2;
//define joystick pins (Analog)
int joyX = 0;
int joyY = 1;
//variable to read the values from the analog pins
int joyVal;
void setup()
{
//attaches our servos on pins PWM 3-5
servo1.attach(3);
servo2.attach(5);
}
void loop()
{
// read the value of the joystick (between 0-1023)
joyVal = analogRead(joyX);
joyVal = map (joyVal, 0, 1023, 0, 180); // servo value between 0-180
servo1.write(joyVal); //set the servo position according to the joystick value
joyVal = analogRead(joyY);
joyVal = map (joyVal, 0, 1023, 0, 180);
servo2.write(joyVal);
delay(15);
}
Yes that is how you would expect it to behave. With the input not connected it floats, and can pick up all sorts of interference from the local environment.
Please read this http://www.thebox.myzen.co.uk/Tutorial/Inputs.html
You have a continuous rotating servo so it will only stop when you feed it the right pulses, either side faster or slower will change the direction.
That might be to do with your power supply. The Arduino can't power even one servo properly by itself and powering two is way beyond its capability. You have to use an external power supply to power the servos. Don't forget to connect the ground of this supply to the ground of the Arduino.
Unfortunately your video will not play for me, the link loads up you tube but shows no video.