You are here

How to reverse direction from VESC UART?

4 posts / 0 new
Last post
vinchi
Offline
Last seen: 2 years 3 months ago
Joined: 2019-12-11 20:12
Posts: 2
How to reverse direction from VESC UART?

Hi!

Can someone please explain how to spin motor reverse direction with VESCUART (SolidGeek) and NunchuckValues?
I can spin it forward but I don't understand how to spin it backwards.

Here is my Arduino example:

#include "VescUart.h"
VescUart VESCUART;

void setup() {

  Serial1.begin(115200);
  VESCUART.setSerialPort(&Serial1);

}

void loop() {

  VESCUART.nunchuck.valueY = 170;
  VESCUART.setNunchuckValues();
  delay(10000);

}

 

At the beginning I thought that 127 value is zero current and values below that are reverse. But it is not working like that.

I have catched raw hex value for reverse from VESC tool "02 05 05 FF FF D8 F0 D4 06 03" but it is to complex for me :)

vinchi
Offline
Last seen: 2 years 3 months ago
Joined: 2019-12-11 20:12
Posts: 2

Looks like I found the solution how it works.

Just need to send negative UART.setDuty() value.

May be someone who is also new to this will find this useful.

 

okanmert89
Offline
Last seen: 4 months 2 weeks ago
VESC Free
Joined: 2022-07-03 20:59
Posts: 1

Hey dude!
Can you show me how you do this?
Can you show it by writing it in lines of code?

ergnmnh
Offline
Last seen: 4 months 1 week ago
VESC Free
Joined: 2023-11-23 15:16
Posts: 5

Hello okanmert89 , if you want to change the duty use this library GitHub - SolidGeek/VescUart: An Arduino library for interfacing with the VESC over UART and you can use like 

float current = 1.0;

UART.setCurrent(current);   or    UART.setDuty(100.0); 

vinchi if you want to understand the data  pls look this link Control with CAN - OpenRobot, Inc (gitbook.io)  remember there are two ids. One of them is uart id which is you can see the vesc software and can id . Your id in gui is decimal , you can see hexa in com port. 

E.E.