/*
Arduino | robotic-help
qwef - Saturday, March 28, 2026 1:02 PM
Hello! I have a problem with my robot.
My robot is a spider robot, with 2 servos (MG90S) on feet.
When I put him on, he doesn't run my code and start each one
servo start make a 360 rotation. I think have a problem on hardware.
(The code is just for one servo because i want test if my code is good.)
*/
#include <Servo.h>
const int NUM_SERVOS = 8;
const int SERVO_PINS[] = {9, 8, 7, 6, 11, 10, 5, 4};
int angle[] = {0, 25, 50, 75, 100, 125, 150, 175};
Servo servo[NUM_SERVOS];
void setup() {
Serial.begin(115200);
Serial.println("Attaching servos");
for (int i = 0; i < NUM_SERVOS; i++) {
servo[i].attach(SERVO_PINS[i]);
servo[i].write(90);
}
delay(1000);
Serial.println("Writing angles");
for (int i = 0; i < NUM_SERVOS; i++) {
servo[i].write(angle[i]);
}
}
void loop() {
// put code here
}