Hey, I'm trying to figure out a way to change the direction of a motor I'm controlling with a joystick connected to an arduino thats sending PPM to the vesc. The issue is that the vesc is configured to accelerate when the joystick is pushed forward and brake when its pushed backwards. Which works just fine, but I want a switch to my arduino that changes the direction of the motor. However since I am simply sending :
"esc.writeMicroseconds(map(analogRead(PotentiometerPin), 520 , 1023, 1500, 2000))"
I can only change the pulse width, with UART I could simply send a negative current to change the direction. But How can I instruct the vesc to accelerate in the other direction? Either through arduino code or vesc tool settings.
I have tried to figure out a way through arduino code to change the "Invert Motor Direction" under General Motor Settings in VESC tool from FALSE to TRUE, as this would change the direction the motor spins (and then back to FALSE when I flip my switch again). But I can't seem to find a way to make it work and I'm worried I would need to flash the vesc whenever changing it and can't do it when running.
Is there a suitable way to change the direction when using PPM control? I've seen remotes that have the option built in but I haven't figured out how they do it