I replaced the potentiometer with two 2200Ω resistors, I've tested each one individually and they work, the problem is when I add the rest of the servo, what happens is that servo1 does not respond properly and independently of what value I write it just keeps spinning clockwise at apparently the same speed.
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <Servo.h>
RF24 radio(6,7); // CE, CSN
const byte address[6] = "00001";
int msg;
int val1;
int val2;
int val3;
int val4;
int val5;
Servo servo1;
Servo servo2;
Servo servo3;
Servo servo4;
Servo servo5;
void setup() {
Serial.begin(9600);
servo1.attach(1);
servo2.attach(2);
servo3.attach(3);
servo4.attach(4);
servo5.attach(5);
servo2.write(85);//These are the modified servos, and with these values they are supposed to stop rotating, atleast they did stop when tested individually
servo1.write(97);
radio.begin();
radio.openReadingPipe(0, address);
radio.setPALevel(RF24_PA_MIN);
radio.startListening();
}
void loop() {
//What I do is send a variable of 4 digits, the first indicates the servo and the remaining the degrees to rotate
if (radio.available()) {
radio.read(&msg, sizeof(msg));
if (msg/1000==1){
val1= msg-1000;
//servo1.write(val1);
}else if (msg/1000==2){
val2=msg-2000;
//servo2.write(msg-2000);
}else if (msg/1000==3){
val3=msg-3000;
servo3.write(msg-3000);
}else if(msg/1000==4){
val4-msg-4000;
servo4.write(msg-4000);
}else if (msg/1000==5){
val5=msg-5000;
servo5.write(val5);
}
Serial.println(msg);
}
}
My only concern with the wiring is the way the connections to the GND and 5V, I attach a pic of what one of these connections looks like, the signal just goes directly to the pin it is assigned to.