A question about multiple pushbuttons
Hello, I'm pretty new to all of this, but I've read some in the basic stamp syntax manual and the whats a microcontroller book, but I guess I'm not getting it. I have attached the code that I'm working with so far. It seems that there must be a better way of doing this. I just want to be able to press a pushbutton and have the BSII make a pin high and when I release the button and press it again it makes the same pin low and repeat continuously. And I want to be able to do this for multiple pushbuttons. Basically just turning a momentary pushbutton into a latching or constant switch (3 times or more). from there, I can control an led or use a transistor to operate a relay etc. Any help is appreciated. Thanks!

Comments
' {$STAMP BS2} ' {$PBASIC 2.5} Init: ' Set pin group A to input low DIRA = %0000 OUTA = %0000 'Set pin group D to output low DIRD = %1111 OUTD = %0000 Main: IF IN0 = 1 THEN TOGGLE 13 IF IN1 = 1 THEN TOGGLE 14 IF IN2 = 1 THEN TOGGLE 15 GOTO MainAlso I forgot to make the pins outputs using the command,
DIRD = %1110
but edited that into the program in my previous post. That leaves the pin p12 as an input.