|
toggle on -- toggle off example code
Posted by Joe Johnson at 2/16/2001 10:20 PM EST
Engineer on team #47, Chief Delphi, from Pontiac Central High School and Delphi Automotive Systems.
In Reply to: Assigning Joystick buttons....
Posted by Bradford Stephens on 2/16/2001 9:36 PM EST:
Try this
Onflag var bit
p1_sw_trig_old var bit
.
.
.
p1_sw_trig_old = 1
Onflag = 0
.
.
.
MainLoop:
.
.
.
if p1_sw_trig_old = 0 and p1_sw_trig = 1 and OnFlag = 1
then TurnOff
if p1_sw_trig_old = 0 and p1_sw_trig = 1 and OnFlag = 0
then TurnOn
goto SetRelays
Turnon:
OnFlag = 1
goto SetRelays
TurnOff:
Onflag = 0
SetRelays:
relay1_fwd = Onflag
.
.
.
goto MainLoop
Good Luck.
Joe J.
P.S. I wrote this from memory on the spot. It may
have bugs, but the
concept seems right to me.
__________________
This message was archived from an earlier forum system. Some information may have been left out. Start new discussion in the current forums, and refer back to these threads when necessary.
|