Thread: C++ Functions
View Single Post
  #2   Spotlight this post!  
Unread 30-01-2009, 16:38
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
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();
This takes the value returned by the retrieve_value() function and assigns it to the variable named variable. In order to make it work properly, the variable and the function must have the same type. (For joystick axis values, I think that type is float.)

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]

Last edited by Alan Anderson : 30-01-2009 at 19:50. Reason: requesting C++ users to help out
Reply With Quote