pause on bs2sx
Archiver
Posts: 46,084
im programing a robot controler and im trying to use PAUSE to delay a
relay. what i need to do is when i press a button on a joy stick it
turns on one motor through a realy then about 1-2 seconds later turn
on a different one and shut off the first one. this is what ive got
so far, but what happens is both relays turn on at the same time and
it just delays the time it take to turn them onn when you press the
button on the joy stick
'>>>>>>>>>>>>Default Code
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
' Port 1 Y axis to PWM1, PWM3: Y-axis forward = CCW (looking at
output socket)
' Port 1 X axis to PWM5: X-axis right = CW (looking at
output socket)
' Port 1 Wheel to PWM7: Wheel forward = CCW (looking at
output socket)
' Port 1 Top to RLY1, RLY2: Button Pressed = CCW (looking at
output socket)
' Port 1 Trigger to RLY1, RLY2: Button Pressed = CW (looking at
output socket)
' Port 3 Y axis to PWM2, PWM4: Y-axis forward = CW (looking at
output socket)
' Port 3 X axis to PWM6: X-axis right = CW (looking at
output socket)
' Port 3 Wheel to PWM8: Wheel forward = CCW (looking at
output socket)
' Port 3 Top to RLY3, RLY4: Button Pressed = CCW (looking at
output socket)
' Port 3 Trigger to RLY3, RLY4: Button Pressed = CW (looking at
output socket)
drive_L = 254 - drive_L
relay1_fwd = p1_sw_trig
relay2_fwd = p1_sw_trig
relay1_rev = p1_sw_top
relay2_rev = p3_sw_top
relay3_fwd = p2_sw_trig
relay3_rev = p2_sw_top
relay4_fwd = p4_sw_trig
relay4_rev = p4_sw_top
if p1_sw_trig = 0 then exit
relay1_fwd = 1
PAUSE 500
relay1_rev = 1
exit:
relay. what i need to do is when i press a button on a joy stick it
turns on one motor through a realy then about 1-2 seconds later turn
on a different one and shut off the first one. this is what ive got
so far, but what happens is both relays turn on at the same time and
it just delays the time it take to turn them onn when you press the
button on the joy stick
'>>>>>>>>>>>>Default Code
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
' Port 1 Y axis to PWM1, PWM3: Y-axis forward = CCW (looking at
output socket)
' Port 1 X axis to PWM5: X-axis right = CW (looking at
output socket)
' Port 1 Wheel to PWM7: Wheel forward = CCW (looking at
output socket)
' Port 1 Top to RLY1, RLY2: Button Pressed = CCW (looking at
output socket)
' Port 1 Trigger to RLY1, RLY2: Button Pressed = CW (looking at
output socket)
' Port 3 Y axis to PWM2, PWM4: Y-axis forward = CW (looking at
output socket)
' Port 3 X axis to PWM6: X-axis right = CW (looking at
output socket)
' Port 3 Wheel to PWM8: Wheel forward = CCW (looking at
output socket)
' Port 3 Top to RLY3, RLY4: Button Pressed = CCW (looking at
output socket)
' Port 3 Trigger to RLY3, RLY4: Button Pressed = CW (looking at
output socket)
drive_L = 254 - drive_L
relay1_fwd = p1_sw_trig
relay2_fwd = p1_sw_trig
relay1_rev = p1_sw_top
relay2_rev = p3_sw_top
relay3_fwd = p2_sw_trig
relay3_rev = p2_sw_top
relay4_fwd = p4_sw_trig
relay4_rev = p4_sw_top
if p1_sw_trig = 0 then exit
relay1_fwd = 1
PAUSE 500
relay1_rev = 1
exit:
Comments
That section of code updates the valiables, but at the bottom of the
full code a SEROUT instruction is used to send those values to co-
processors which handle the actual control.
That SEROUT must be ran before your pause.
Also, be aware, that too long a pause will cause the controller into
a "fail" mode since iit much receive data within set time limits or
it will assume there was a hardware failure.
-Martin Hebel
Southern Illinois University
Electronic Systems Technology
--- In basicstamps@yahoogroups.com, "Johnny Longshank
<johnny_longshank69@y...>" <johnny_longshank69@y...> wrote:
> im programing a robot controler and im trying to use PAUSE to delay
a
> relay. what i need to do is when i press a button on a joy stick it
> turns on one motor through a realy then about 1-2 seconds later
turn
> on a different one and shut off the first one. this is what ive got
> so far, but what happens is both relays turn on at the same time
and
> it just delays the time it take to turn them onn when you press the
> button on the joy stick
>
> '>>>>>>>>>>>>Default Code
> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>
> ' Port 1 Y axis to PWM1, PWM3: Y-axis forward = CCW (looking at
> output socket)
> ' Port 1 X axis to PWM5: X-axis right = CW (looking at
> output socket)
> ' Port 1 Wheel to PWM7: Wheel forward = CCW (looking at
> output socket)
> ' Port 1 Top to RLY1, RLY2: Button Pressed = CCW (looking at
> output socket)
> ' Port 1 Trigger to RLY1, RLY2: Button Pressed = CW (looking at
> output socket)
>
> ' Port 3 Y axis to PWM2, PWM4: Y-axis forward = CW (looking at
> output socket)
> ' Port 3 X axis to PWM6: X-axis right = CW (looking at
> output socket)
> ' Port 3 Wheel to PWM8: Wheel forward = CCW (looking at
> output socket)
> ' Port 3 Top to RLY3, RLY4: Button Pressed = CCW (looking at
> output socket)
> ' Port 3 Trigger to RLY3, RLY4: Button Pressed = CW (looking at
> output socket)
>
>
> drive_L = 254 - drive_L
>
> relay1_fwd = p1_sw_trig
> relay2_fwd = p1_sw_trig
> relay1_rev = p1_sw_top
>
>
> relay2_rev = p3_sw_top
> relay3_fwd = p2_sw_trig
> relay3_rev = p2_sw_top
> relay4_fwd = p4_sw_trig
> relay4_rev = p4_sw_top
>
>
> if p1_sw_trig = 0 then exit
>
> relay1_fwd = 1
> PAUSE 500
> relay1_rev = 1
>
>
> exit: