can you do this with simple pointers somehow?
s2jesse
Posts: 62
repeat buttonCheck(right, rightState, rightPressed, rightReleased) if rightPressed OutA[noparse][[/noparse]led] := ledOn if rightReleased OutA[noparse][[/noparse]led] := ledOff PUB buttonCheck(button, buttonState, buttonPressed, buttonReleased) if ina[noparse][[/noparse]button] <> buttonState 'if button has changed 'CHANGED if ina[noparse][[/noparse]button] 'PRESSED buttonPressed:=1 else 'RELEASED buttonReleased:=1 else 'NO CHANGE buttonPressed:=0 buttonReleased:=0 buttonState := ina[noparse][[/noparse]button]
i want this little button meathod to work with multiple buttons and pass in which button i want to change the variable for... can i do that by doing something similar to what i have here with pointers to the variables? i already have the state,pressed, and released variables declared ahead of time.
Jesse
Comments
·
make lastdebouncetime external - same as other paras
if state is not-pressed and ina[noparse][[/noparse]button] <> not-pressed
state := maybepressed
debouncetime = cnt
elseif state is maybepressed and cnt - debouncetime > delay
if ina[noparse][[/noparse]button] <> not-pressed
state = pressed
similar for other states