;
; Toggle_velocity.txt script
;
; The scripts checks state of digital input 7,8 and set drive speed accordingly
; IN 7 | IN 8 | V
; 0 | 0 | 0
; 1 | 0 | 200
; 0 | 1 | -200
; 1 | 1 | 0
; Digital input setup
#Print .........Digital_Inputs_Setup
inmode 7 0
inmode 8 0
ininv 7 0
ininv 8 0
;Variable for digital input 7,8 state
#var $in_state
#var $in_7
#var $in_8
;enter the drive to serial velocity loop
k
opmode 0
en
;infinite loop
#While 1>0
;read state of in 7 and in 8
$in_7 = {in 7}
$in_8 = {in 8}*2
$in_state =$in_7+$in_8
#If $in_state == 0 jog_zero
#If $in_state == 1 jog_positive
#If $in_state == 2 jog_negative
#Label jog_zero
#Print JOG_zero
j 0
#Goto end_loop
#Label jog_positive
#Print JOG_plus_200
j 200
#Goto end_loop
#Label jog_negative
#Print JOG_minus_200
j -200
#Label end_loop
#Delay 500
#End_While