0

Control VESC with arduino
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Control VESC with arduino

by pumpkinheadnick on Sat May 11, 2019 2:59 pm

Hello. I have ordered a VESC and have learned to communicate with it over UART. The issue is that I don't quite understand how to pull a specific member's value from a struct. I am using this library https://github.com/RollingGecko/VescUartControl/tree/VESC6.

This is the first time I have ever encountered a struct. If you look at their example code it serial prints the entire struct at once somehow. If you look into the local_datatypes file you can see the struct they reference.

I have read this https://forum.arduino.cc/index.php?topic=42681.0 which did not have too much info. Later I found this https://www.tutorialspoint.com/cprogramming/c_structures.htm which I thought was more useful.

After reading that I figured something like
Code: Select all | TOGGLE FULL SIZE
Serial.println(measuredVal.rpm);
would work but it just returns 0.

Any ideas???

pumpkinheadnick
 
Posts: 65
Joined: Mon Jan 04, 2016 8:23 pm

Re: Control VESC with arduino

by adafruit_support_bill on Sat May 11, 2019 6:33 pm

That is the way to access members of a struct. As for the content of that member, that is a question you should ask the author of the library.

adafruit_support_bill
 
Posts: 74639
Joined: Sat Feb 07, 2009 10:11 am

Re: Control VESC with arduino

by pumpkinheadnick on Sun May 12, 2019 12:33 am

Alright thanks for the confirmation. I will try to contact them, not sure what luck I will have.

pumpkinheadnick
 
Posts: 65
Joined: Mon Jan 04, 2016 8:23 pm

Please be positive and constructive with your questions and comments.