i have been coding a simple robot face using 3 servos, it was going good until i added another movement for the face on one of the servos and now no matter what i do the jaw moves down 180 and then goes to 0 (hits himself in the face) over and over again. i dont have the jaw set to this i have the jaw set to 90 to 145 and repeat. i dont believe i have any errors in my code and it definetly does NOT say to do that, please help.
code:
#include <Servo.h>
Servo myservo;
Servo my1servo;
Servo my2servo;
// create servo object to control a servo
// twelve servo objects can be created on most boards
int pos = 0; // variable to store the servo position
void setup()
{
myservo.attach(9);
my2servo.attach(8);
my1servo.attach(10);
void loop()
{
for (pos = 90; pos <= 145; pos += 1) {
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
for (pos = 145; pos >= 90; pos += 1) {
myservo.write(pos);
delay(15);
}
for (pos = 125; pos <= 180; pos += 1) {
my1servo.write(pos);
my2servo.write(pos);
delay(15);
}
for (pos = 90; pos <= 145; pos += 1) {
myservo.write(pos);
delay (15);
}
for (pos = 180; pos <= 125; pos += 1) {
my1servo.write(pos);
my2servo.write(pos);
delay (15);
}
}