anthonycarson
09-13-2008, 12:39 AM
' {$STAMP BS2}
value·· VAR Byte
start:
SERIN 16,16468, [HEX value]
IF value = 61 THEN relay1
IF value = 62 THEN relay2
GOTO start:
relay1:
DEBUG "testing relay 1"· ,CR
HIGH 7
GOTO relayOff
relay2:
DEBUG "testing relay 2"·· ,CR
HIGH 8
GOTO relayOff
relayOff:
SERIN 16,16468,[value]
IF value = 61 THEN relayOff2
GOTO relayOff
relayOff2
DEBUG "turning relay off!" ,CR
LOW 7
LOW 8
GOTO start:
This code is supposed to allow a input from the keyboard in ascII 9600 8 N 1 to the stamp to turn on a relay at pin 7 and pin 8. When the letter "a" or "b" in lower case is typed into the keyboard the program instructs it to go to the corresponding label and run the label while waiting another input of the letter "a" in lower case. It is not working! Why? is the HEX supposed to have another modifier? or the varriable "value" not a kosher word to use? Something makes the code not function like desired... Please help!
Anthony
value·· VAR Byte
start:
SERIN 16,16468, [HEX value]
IF value = 61 THEN relay1
IF value = 62 THEN relay2
GOTO start:
relay1:
DEBUG "testing relay 1"· ,CR
HIGH 7
GOTO relayOff
relay2:
DEBUG "testing relay 2"·· ,CR
HIGH 8
GOTO relayOff
relayOff:
SERIN 16,16468,[value]
IF value = 61 THEN relayOff2
GOTO relayOff
relayOff2
DEBUG "turning relay off!" ,CR
LOW 7
LOW 8
GOTO start:
This code is supposed to allow a input from the keyboard in ascII 9600 8 N 1 to the stamp to turn on a relay at pin 7 and pin 8. When the letter "a" or "b" in lower case is typed into the keyboard the program instructs it to go to the corresponding label and run the label while waiting another input of the letter "a" in lower case. It is not working! Why? is the HEX supposed to have another modifier? or the varriable "value" not a kosher word to use? Something makes the code not function like desired... Please help!
Anthony