kurte wrote:
Looks good. So far I have not had any problems with the way the several programs up here deal with only processing a button once. That is they remember the previous button states and only process the button when that state changes.
Code:
...
shiftin PS2DAT,PS2CLK,FASTLSBPOST,[DualShock(0)\8, DualShock(1)\8, DualShock(2)\8, DualShock(3)\8, |
DualShock(4)\8, DualShock(5)\8, DualShock(6)\8]
high PS2SEL
pause 10
IF (DualShock(1).bit3 = 0) and LastButton(0).bit3 THEN ;Start Button test
IF(RoverOn) THEN
;Turn Rover off
RoverOn = False
ELSE
;Turn Rover on
RoverOn = True
ENDIF
ENDIF
...
LastButton(0) = DualShock(1)
LastButton(1) = DualShock(2)
RETURN
I don't really get how I could apply this to what I am doing. I don't understand what you are doing in your code.
Here is my latest code. No rocket science. I just replaced the counter with a bit variable.
Code:
' Remote / Automomous Control Toggle
if Button_A and A_Enable then
if Autonomous then
Autonomous = 0
serout S_OUT,i9600,["Remote control..",13]
else
Autonomous = 1
serout S_OUT,i9600,["Autonomous..",13]
endif
A_Enable = FALSE
else
if Button_A then
A_Enable = FALSE
else
A_Enable = TRUE
endif
endif
It works for me, and I understand what is going on, so will likely stay with it.
8-Dale