main: if pin1 = 1 then gosub LEDon if pin2 = 1 then gosub LEDoff goto main
LEDon: high 3 return
LEDoff: low 3 return
It doesn’t involve use of memory if you don’t need to know the state later in your program. And you don’t need the debounce delay as the sub will only execute on button press and if it does it several times it doesn’t matter.
I think I understand what you mean, I didnt think I had to debounce the switches s I was unsure about that, anyways I got it working thanks for the advices!
Switch debouncing is a problem that occurs with mechanical switching. The signal bounces on an off for a period and might mess up your program. You can read more about it here http://www.labbookpages.co.uk/electronics/debounce.html