[SOLVED] Commander: cannot get any value

I am using SimpleFOC@ 2.1 with Arduino Nano. For some reason, I can set the value to the MCU but I cannot get the current value. Let’s show you a practical example.

In my code I set:

motor.PID_velocity.P = 0.15

Through the serial interface, if I type MVP, I get:

PID vel| P: 0.0000

At this point, it seems that the Velocity P-value is overridden with P=0 (tested by manually disturbing the motor).

If I set manually MVP0.15 and get the value that I just sent, again with MVP, at this round I get:

PID vel| P: 15.0000

This is my commander setup:

Commander commander = Commander(Serial);
void onMotor(char* cmd){commander.motor(&motor, cmd);}
    // initialize motor
    // align sensor and start FOC

    commander.add('M',onMotor,"my motor");
    commander.decimal_places = 4;

void loop() 

The velocity P-value is just an example because it does not work for any get that I try to use from Commander interface :pensive:

Hey @well1010, have you your Serial Monitor set to “Newline”?

Thanks a lot! Apparently it was my mistake to don’t pay attention to this detail.

As a reference for whoever will encounter this problem, I was using the Arduino with the default setup, that’s \n\r:

Switching over newline option, that’s \n, it works:

1 Like