if you need to test out a servo, this is code for it, it fully rotates your servo one way, and then the other to make sure its all good
// made by salim sargi
// material needed : arduino board, servo, jumper wires
// connect the black/brown wire to gnd, the red one to 5v/vcc and the yellow/orange one to pin 3, output
// this code allows you to test your servo by making it slowly fully turn counter clockwise and then fully clockwise.
#include <Servo.h>
int servoPin = 3; //the pin that the servo will be attached to
Servo Servo1; // creates a sevo object
int dec = 5; // this determines by how much the servo will turn each 100 ms, of 5 degrees
int val = 5; // this determines the position of the servo
void setup() {
Servo1.attach(servoPin);
}
void loop(){
Servo1.write(val);
val = val + dec ;
delay(100);
if (val == 180) {
dec = dec * (-1);
}
// if the servo has fully turned, this allows it to turn the other way
if (val == 0) {
dec = dec * (-1);
}
// if the servo has fully turned, this allows it to turn the other way
}
// end of code