Allora secondo me era un problema di driver degli stepper....evidentemente qualcuno bruciato. Sono passato ai TB66000 e tutto funziona correttamente rispondendo al controller ps2.... l'unico problema (e direi da non poco) è che i motori dopo poco si surriscaldano nonostante i driver siano settati al minimo della corrente (quindi tutti i pin su on!).
Mi è venuto in mente che potrebbe essere un problema di codice? Ovvero che manda sempre impulsi e quindi pur stando fermi è come se ricevessero sempre comandi?
void loop() {
ps2x.read_gamepad(false, vibrate); //read controller, don't record arrow pressures, and set large motor to spin at 'vibrate' speed
stickX = ps2x.Analog(PSS_LX); // set the analog value of the right stick X-Axis equal (0-255)
stickY = ps2x.Analog(PSS_RY); // set the analog value of the right stick X-Axis equal (0-255)
stickZ = ps2x.Analog(PSS_RX); // set the analog value of the right stick X-Axis equal (0-255)
// MUOVO X-AXIS //
int mapX = stickX; // set the desired stepper position equal to the Y-Axis value (0-255)
//Serial.println(stickX);
if (mapX > 123) { // if the Y-Axis stick position is positive
motoreX.setSpeed(5000);
motoreX.setAcceleration(30);
motoreX.run();
//Serial.println("muovo X avanti");
} else if (mapX < 123) { // if the Y-Axis stick position is negative
motoreX.setSpeed(-5000);
motoreX.setAcceleration(30);
motoreX.run();
//Serial.println("muovo X indietro");
} else {
motoreX.stop();
}
// MUOVO Y-AXIS //
int mapY = stickY; // set the desired stepper position equal to the Y-Axis value (0-255)
//Serial.println(stickY);
if (mapY > 132) { // if the Y-Axis stick position is positive
motoreY.setSpeed(5000);
motoreY.setAcceleration(30);
motoreY.run();
//Serial.println("muovo X avanti");
//Serial.println(stickY);
} else if (mapY < 123) { // if the Y-Axis stick position is negative
motoreY.setSpeed(-5000);
motoreY.setAcceleration(30);
motoreY.run();
//Serial.println("muovo X indietro");
//Serial.println(stickY);
} else {
motoreY.stop();
}
// MUOVO Z-AXIS //
//Serial.println(stickZ);
int mapZ = stickZ; // set the desired stepper position equal to the Y-Axis value (0-255)
if (mapZ > 132) { // if the Y-Axis stick position is positive
motoreZ.setSpeed(5000);
motoreZ.setAcceleration(30);
//Serial.println("muovo Z avanti");
motoreZ.run();
} else if (mapZ < 123) { // if the Y-Axis stick position is negative
motoreZ.setSpeed(-5000);
motoreZ.setAcceleration(30);
motoreZ.run();
//Serial.println("muovo Z indietro");
//Serial.println(mapZ);
} else {
motoreZ.stop();
}
}