![]() |
C++ Functions
Is there a function in the WindRiver language that allows me to take the value of the joystick (speed of motor) and make it into a variable so that you can compare how fast you are intending to go based on joystick location and compare it to the actual speed?
|
Re: C++ Functions
There's not a WPI library function for what you want, but there is a simple feature of the C language called an "assignment". It is implemented using the equals sign = character.
Code:
variable = retrieve_value();If you didn't already know this, you should probably find and follow a basic C/C++ programming tutorial. Finding and following a knowledgeable mentor would be a good idea as well. [edit] I'm focusing on LabVIEW this season, so I'm not confident in my ability to give correct examples using the C++ classes to an insufficiently experienced programmer. Would someone else please answer specific questions about reading Joystick data? [/edit] |
Re: C++ Functions
Thank you very much. So if I use the float variable of the retrieve_value() function I can get the joystick speed?
|
Re: C++ Functions
No, I don't believe that there's a function called retrieve_value() function. Try looking at WPILib and seeing what functions there are for the joystick class.
|
Re: C++ Functions
If you're using the SimpleRobot demo, then you would use the instance of the Joystick class to retrieve the value of the Joystick.
Code:
// assuming that there is an instance of the Joystick class called 'stick' in the current scopeReading the WPILib source code is the best way to understand how things work underneath. |
Re: C++ Functions
Okay I'll try that. Thank you very much.
|
| All times are GMT -5. The time now is 02:39. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi