BS2 Serial question.... Please help me out.`
Archiver
Posts: 46,084
I have a need to program a BS2 to respond differently, based upon
certain characters received at the serial port. I need it to go into
a loop when the letter 'S' is received, but then break out of the
loop if, for example, the characters 'F1' are received.
Is this in any way possible with the Stamp? If so, how? If not, is
there any additional circuitry that can help?
Thanks....
Jim D. Martin
certain characters received at the serial port. I need it to go into
a loop when the letter 'S' is received, but then break out of the
loop if, for example, the characters 'F1' are received.
Is this in any way possible with the Stamp? If so, how? If not, is
there any additional circuitry that can help?
Thanks....
Jim D. Martin
Comments
break out of the
loop if, for example, the characters 'F1' are received.
>
> Is this in any way possible with the Stamp? If so, how? If not, is
> there any additional circuitry that can help?
Loop:
serin pin,baud,10000 , noinput, [noparse][[/noparse]datain] ' relay input section
if datain = "S" then onA 'loop A in
if datain = "F1" then offA 'loop A out
if datain = " " then Loop
Noinput:
Debug "No Input",cr
Goto Loop
onA:
'your code here for loop A
goto loop
offA:
' your code her for loop A out
goto loop
- Now if you want to trap the "F1" key, that is different that just the
characters "F" and "1".... but this should give you general idea
Dave