|
Re: chaging values on an axis/toogle switch
You can clamp the joystick values from the joystick pretty easily.
float inputZ = stick->GetZ();
if(inputZ < 0.0)
inputZ = 0.0;
motor->Set(inputZ);
As for the toggle switch, what exactly are you using it for? If you are wanting to use a toggle switch that you on the driver station digital IO, you can just check the driver station inputs with driverStation->GetDigitalInput(channel);
EDIT: The above method for clamping would disregard anything below 0. If you want -1 to equal 0, 0.0 to equal 0.5, and 1.0 to equal 1.0, you can do this (although it would be very unintuitive for the driver):
motor->Set((stick->GetZ()+1.0)/2);
Last edited by Sentient : 11-02-2009 at 20:42.
|