Okay we have tried several things, and are trying to mutate these functions, but are unable to and we are unsure of how.
We are trying to get it to several things:
when we use Joystick to do the function GetX() it says GetX() hasn’t been defined, and we tried Joystick.GetX() and it says you need a parent class or something b4 Joystick, so how do I declare GetX??
We are trying to use the log function also in this, but we can’t find a way to convert float to a non double number or a double number for use by myRobot.. ect…
How do you do a state machine with a button?
This is confusing, and I have looked through the header files to try and understand what is going on, but the files just call a bunch more header files and it just looks all stubbed out, and it seems really hard to mutate, so any help would be very nice!
You need to create an instance of the Joystick class. This should be done as a member variable in your robot class, outside of any of the functions in it.
Joystick stick(1); // USB joystick in port 1.
After you have your Joystick object created, you can use it like this:
float value = stick.GetX(); // Get the X value of the joystick.