master
Yorick GEOFFRE 2 years ago
parent 06a572af56
commit a8686be00f

@ -89,9 +89,6 @@ void loop() {
// Map the duty cycle value to the range of -1.0 to 1.0
mappedDutyCycles[i] = mapFloat(dutyCycle, minDutyCycle[i], maxDutyCycle[i], -1.0, 1.0);
Serial.print(i);
Serial.print(" ");
Serial.println(period);
// Apply deadzone
if (mappedDutyCycles[i] > -deadzone && mappedDutyCycles[i] < deadzone) {
mappedDutyCycles[i] = 0.0;
@ -126,17 +123,16 @@ void loop1() {
updateServos();
handleSerialCommands();
// Print the pin name and the mapped duty cycle in a format suitable for the Serial Plotter
/*for (int i = 0; i < numPins; i++) {
for (int i = 0; i < numPins; i++) {
Serial.print(pwmPins[i]);
Serial.print(":");
Serial.print(mappedDutyCycles[i]);
if (i < numPins - 1) {
Serial.print(",");
} else {
Serial.println();
}
}*/
}
delay(1); // Wait for 1ms before the next transmission
}
@ -229,6 +225,11 @@ void modeCheck(){
}
void updateServos(){
servo1->setPWM(servoPins[0],60,servo1Perc+5.5f); //accelerateur
servo2->setPWM(servoPins[1],60,servo2Perc); //dir
float s1v = (servo1Perc/2)+(6.25f+1.625f);//-1.9f;
float s2v = (servo2Perc/2)+(6.25f+1.625f);
servo1->setPWM(servoPins[0],60,s1v); //accelerateur
servo2->setPWM(servoPins[1],60,s2v); //dir
Serial.print(s1v);
Serial.print(" ");
Serial.println(s2v);
}
Loading…
Cancel
Save