Posted by Vicente Gonzales at 2/18/2001 2:28 PM EST
Engineer on team #647, CyberWolves, from Shoemaker High School and Operational Test Command.
I am trying to use the wheel off of joystick 2 as a relay output to a spike to control a cylinder. I’ve tried to change the program, but have been unsuccessful. Does anyone know where I can get some info on how to change a PWM input (from the wheel, in my case) to a relay output?
Thanks in advance for any help.
Posted by Nate Smith at 2/18/2001 3:20 PM EST
Other on team #66, Frostbite, from Willow Run High School and GM Powertrain.
In Reply to: Joy2 Wheel use as switch
Posted by Vicente Gonzales on 2/18/2001 2:28 PM EST:
: I am trying to use the wheel off of joystick 2 as a relay output to a spike to control a cylinder. I’ve tried to change the program, but have been unsuccessful. Does anyone know where I can get some info on how to change a PWM input (from the wheel, in my case) to a relay output?
: Thanks in advance for any help.
Try this…
-
First, use the debug statement in your program to get the values for the positions that you want to use, just in case that the max and min values are not quite 0 and 254.
-
Then, put code similar to this in your program
(note: this code assumes relay 3)
relay3_fwd = 0
relay3_rev = 0
if p2_wheel = 0 then relay_3_reverse
if p2_wheel = 254 then relay_3_forward
; turn off relay 3
goto relay_3_done
relay_3_reverse:
relay3_rev = 1
goto relay_3_done
relay_3_forward:
relay3_fwd = 1
relay_3_done:
Try that out and feel free to ask if you have any questions…
Nate
Posted by Joe at 2/18/2001 8:32 PM EST
Student on team #506 from St. Anthony’s HS.
In Reply to: Re: Joy2 Wheel use as switch
Posted by Nate Smith on 2/18/2001 3:20 PM EST:
That would work but I believe there is an easier way. Rather than relying on the max and min numbers just use greater than/less than. That way if the max and min are off then it will still function
(keeping with using relay 3)
relay3_fwd = 0
relay3_rev = 0
if p2_wheel > 170 then relay_3_forward
if p2_wheel
Posted by Gui Cavalcanti at 02/21/2001 5:00 PM EST
Student on team #422, Mech Tech, from Governor’s School (GSGIS) and Verizon.
In Reply to: Re: Joy2 Wheel use as switch
Posted by Joe on 2/18/2001 8:32 PM EST:
While the previous two suggestions are OK, I’m thinking that for a switch you don’t need a massive deadzone. Try this, it’s also very streamlined. Remember that the potentiometer wheel’s middle is 127!
This is just a lot easier than any of the previous suggestions and divides the wheel equally right down the middle. Psst… it’s easier to use a 3-state toggle switch, by the way 
if (p2_wheel > 127) then relay_3_forward
relay3_fwd = 0
relay3_rev = 1
goto SkipForward:
relay_3_forward:
relay3_fwd = 1
relay3_rev = 0
SkipForward: