When I move the servos at the same time, they do not move as I want, they get mixed up and make different movements. The code is here
#include <Servo.h>
// Servo motorlarını tanımla
Servo frontLeftMotor1;
Servo frontLeftMotor2;
Servo frontRightMotor1;
Servo frontRightMotor2;
Servo backLeftMotor1;
Servo backLeftMotor2;
Servo backRightMotor1;
Servo backRightMotor2;
void setup() {
// Servoları uygun pinlere bağla
frontLeftMotor1.attach(2); // Servo 1, Pin 2
frontLeftMotor2.attach(3); // Servo 2, Pin 3
frontRightMotor1.attach(4); // Servo 3, Pin 4
frontRightMotor2.attach(5); // Servo 4, Pin 5
backLeftMotor1.attach(6); // Servo 5, Pin 6
backLeftMotor2.attach(7); // Servo 6, Pin 7
backRightMotor1.attach(8); // Servo 7, Pin 8
backRightMotor2.attach(9); // Servo 8, Pin 9
// Başlangıçta tüm servoları 90 dereceye ayarla
frontLeftMotor1.write(90);
frontLeftMotor2.write(90);
frontRightMotor1.write(90);
frontRightMotor2.write(90);
backLeftMotor1.write(90);
backLeftMotor2.write(90);
backRightMotor1.write(90);
backRightMotor2.write(90);
delay(1000); // Servoların 90 dereceye ayarlandığından emin olmak için 1 saniye bekle
}
void loop() {
// İleri hareket için servoları belirli bir açıya ayarla
moveForward();
}
void moveForward() {
// Ön sol ayak - servoları ileriye hareket ettir
frontLeftMotor1.write(45); // İlk servo (açı değiştirilebilir)
delayMicroseconds(500); // Mikro-delay ile zamanlama
frontLeftMotor2.write(135); // İkinci servo (açı değiştirilebilir)
delayMicroseconds(500); // Mikro-delay ile zamanlama
// Ön sağ ayak - servoları ileriye hareket ettir
frontRightMotor1.write(45); // İlk servo
delayMicroseconds(500); // Mikro-delay ile zamanlama
frontRightMotor2.write(135); // İkinci servo
delayMicroseconds(500); // Mikro-delay ile zamanlama
// Arka sol ayak - servoları ileriye hareket ettir
backLeftMotor1.write(45); // İlk servo
delayMicroseconds(500); // Mikro-delay ile zamanlama
backLeftMotor2.write(135); // İkinci servo
delayMicroseconds(500); // Mikro-delay ile zamanlama
// Arka sağ ayak - servoları ileriye hareket ettir
backRightMotor1.write(45); // İlk servo
delayMicroseconds(500); // Mikro-delay ile zamanlama
backRightMotor2.write(135); // İkinci servo
delayMicroseconds(500); // Mikro-delay ile zamanlama
}
