Closed RadekVoltr closed 3 years ago
ok, it looks that problem is in case that 3 servos have same frequency. Servo 3 is then set to channel 8. Some how it gets workarrounded by using different frequency so 3rd servo goes to channel number 2 but then I get strange pulse each 1s.
servo1.setPeriodHertz(50); // Standard 50hz servo
servo2.setPeriodHertz(50); // Standard 50hz servo
servo3.setPeriodHertz(49); // Standard 50hz servo
hmm, i use this library with 16 independant servos regularly. can you link to a whole project i can run and try it?
Ok, I will investigate it on my end first and let you know.
Omg, I am idiot.
Using external power source for servos and forgot to connect ground during development. For some reason it was able work on 2 servos and not on more. I am very , very sorry.
no worries :) Happy roboting!
With following code :
`// create four servo objects Servo servo1; Servo servo2; Servo servo3; // Published values for SG90 servos; adjust if needed int minUs = 1000; int maxUs = 2000;
int servo1Pin = 21; int servo2Pin = 22; int servo3Pin = 23;
void setup() {
servo1.writeMicroseconds(1200); delay(1); servo2.writeMicroseconds(1200); delay(1); servo3.writeMicroseconds(1200); delay(1);
delay(10000);
servo1.writeMicroseconds(1500); delay(1); servo2.writeMicroseconds(1500); delay(1); servo3.writeMicroseconds(1500); delay(1);
delay(10000);
//servo1.writeMicroseconds(1800); delay(1); servo2.writeMicroseconds(1800); delay(1); servo3.writeMicroseconds(1800); delay(1);
delay(10000);` servo gets crazy. I can use 2 of them. Doesn't matter which ones but after I send 3rd request, it push servo to one side and ignore other changes including stop.
ESP32 Wroom32 Dev Kit compile with Platform.io, library from their storage