Hey @lulezi,
Were you able to get around this problem?
I would suggest you not to use the approach that you have shown but just use a function like this:
void changeZeroAngle() {
// a string to hold incoming data
static String received_chars;
while (Serial.available()) {
// get the new byte:
char inChar = (char)Serial.read();
// add it to the string buffer:
received_chars += inChar;
// end of user input
if (inChar == '\n') {
// chage the guess
float guess = received_chars.toFloat()*2*_PI/360;
motor.zero_electric_angle = guess;
// reset the command buffer
received_chars = "";
}
}
}
And then just add this function to your loop()
:
void loop(){
...
changeZeroAngle();
}
Then you just send a number in between 0 and 360 through serial. This will allow you to guess quicker and more precisely.
Otherwise, since this is very strange problem and it is troubling me a bit I would be happy to sned you an additional SimpleFOCShield hoping that that might resolve the issue