im extremely confused about buttons. ive read the section in the basic manual several times, and played with them a little. however, ive gotten two conflicting definitions of the last parameter on target state. 1) that is says which state the button should be in in order to branch 2) that when in downstate, 0 it doesnt branch and 1 it does. also, ive been trying to program a kill switch in that is basically a button statement that says when the button is pressed, goto a subroutine that puts the program into an infinite loop. ive written this program before for the edu robot and had it work, and i also have last year’s code which is working. but mine isnt, and i cant figure out why.the program goes into the kill switch subroutine whether the button is pressed or not, and wont get out of the subroutine. here is the code:
the pin is p4_sw_aux1, and ive already tested the mechanical switch and it works physically.
*in main section
BUTTON p4_sw_aux1, 0, 255, 0, wksp, 0, KillSwitch:
*in subroutine section
KillSwitch:
Serin COMA\COMB, INBAUD, [oi_swA,oi_swB,rc_swA,rc_swB,p2_x,p1_x,p4_x,p3_x,PB_mode,packet_num,p2_y,p1_y,p4_y,p3_y,p2_wheel,p1_wheel,p4_wheel,p3_wheel]
BUTTON p4_sw_aux1, 0, 255, 0, wksp,1, Mainloop:
Serout USERCPU, OUTBAUD, [255,255,127,0,127, 0, 127,127,127,127,127,127,127,127,127,127,127,127,127,127]
GOTO KillSwitch: