To give further context, I have a school proyect where I had to build a mechanical arm (as seen above), using 6 servos and an Arduino UNO, and have it move objects. The hardware and code work works perfectly:
#include <Wire.h>
#include <Adafruit\_PWMServoDriver.h>
#include <SoftwareSerial.h>
// Bluetooth pins(RX, TX)
SoftwareSerial BT(0, 1);
Adafruit_PWMServoDriver pca = Adafruit_PWMServoDriver();
#define SERVOMIN 150
#define SERVOMAX 600
const int servo1 = 0;
const int servo2 = 1;
const int servo3 = 2;
const int servo4 = 3;
const int servo5 = 4;
const int servo6 = 5;
void setup() {
Serial.begin(9600);
BT.begin(9600);
Serial.println("Control of 6 servos via Bluetooth ready");
pca.begin();
pca.setOscillatorFrequency(27000000);
pca.setPWMFreq(50);
delay(10);
// security position of the 6 servos (90 degrees)
moverServo(servo1, 90);
moverServo(servo2, 90);
moverServo(servo3, 90);
moverServo(servo4, 90);
moverServo(servo5, 180);
moverServo(servo6, 90);
}
void moverServo(int canal,…