Basic Stamp Pushbutton Holder
Bibbi
Posts: 4
I'm starting with push buttons right now, and I've come across a little problem of sorts, and I'm sure I can't fix it in the code.
HIGH 1
Main:
IF (IN2 = 1) THEN
HIGH 10
PAUSE 500
LOW 10
PAUSE 500
ELSE
HIGH 5
PAUSE 500
LOW 5
PAUSE 500
ENDIF
GOTO Main
Here's a couple of note's:
1) The reason pin 1 is high, is because I currently don't have a 5V power supply for my push button.
2) The reason it's pin 1, is because I accidentally used 9V power supply that is powering my Basic Stamp on pin 0
Anyway, my question is, is there anyway to make it so that if I push the button on pin 2, that it'll say it was pressed when it gets back to the if statement? Because as of right now, I need to be holding it down when it reaches the if statement to activate the code in the if of the if statement, but I want it to activate something (probably will need to be something on the circuit) that will stay on until the if statement is reached, and then turn that something off.
Any ideas? If it's on the circuit board, please include a wiring diagram.
HIGH 1
Main:
IF (IN2 = 1) THEN
HIGH 10
PAUSE 500
LOW 10
PAUSE 500
ELSE
HIGH 5
PAUSE 500
LOW 5
PAUSE 500
ENDIF
GOTO Main
Here's a couple of note's:
1) The reason pin 1 is high, is because I currently don't have a 5V power supply for my push button.
2) The reason it's pin 1, is because I accidentally used 9V power supply that is powering my Basic Stamp on pin 0
Anyway, my question is, is there anyway to make it so that if I push the button on pin 2, that it'll say it was pressed when it gets back to the if statement? Because as of right now, I need to be holding it down when it reaches the if statement to activate the code in the if of the if statement, but I want it to activate something (probably will need to be something on the circuit) that will stay on until the if statement is reached, and then turn that something off.
Any ideas? If it's on the circuit board, please include a wiring diagram.
Comments
This is pseudo-code. It will NOT run...
It is also possible to do code so that the first press of the switch starts the slow flashes, and a second press stops the slow flashes, OR a second switch can be used in place of a second press. (Welcome to the world of software design!)
--Rich
P.S., this should probably have been posted in the BASIC Stamp forum!
All I want is if a button was pushed in let's say this code
Main:
IF IN1 = 1 THEN TOGGLE 2
PAUSE 10000
GOTO Main
at the 5 second mark of the 10 second pause, that something would make sure the if statement would activate when this loops, even if the button was pressed for the shortest amount of time possible.