Quote:
Originally Posted by touchdownjesus4
I tried to use the getRawAxis(3) earlier and it didn't work.
|
getRawAxis(3) works for us. make sure your joystick object is initialized
Some sample code assuming you're using simpleRobot or equivalent.
place this is your class:
Code:
Joystick joy1; //define a variable accessible to all methods in your class
Add this to your init method
Code:
joy1 = new Joystick(1); // make a new joystick object on port 1
Add this to whereever you're trying to read the joystick (teleop?)
Code:
joy1.getRawAxis(3);
That returns a double, store it in a variable for use or manipulate it directly...
Quote:
|
Just for my knowledge, how would I go about inverting it? And also if we only need to drive the motor one direction (it's just a spinning wheel) is there a way to have it only go from 0 to 1 or 0 to -1?
|
Inverting would be multiply by -1
scaling in the case you asked would be (
value + 1) / 2
Any data manipulation in FRC, you should be able to get a decent implementation using high school math courses( algebra, geometry, ...maybe some calc) - yea there is actually a practical use for that stuff you're required to learn