Shop OBEX P1 Docs P2 Docs Learn Events
SERIN WAIT equivalent for BS1 — Parallax Forums

SERIN WAIT equivalent for BS1

scary terryscary terry Posts: 24
edited 2008-03-23 21:50 in BASIC Stamp
Hi All,
I've got a circumstance where I'm looking for the word "Stop" from an external device before a program can proceed. I can use the SERIN command on a BS2 as such: SERIN 1, 84, [noparse][[/noparse]WAIT ("Stop")] and it works fine. I'd like to do something similar with a BS1 but I know that command is not available. Any ideas on how I can accomplish the same thing on a BS1?

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-03-20 18:10
    Look in the Stamp Basic Manual about 8 or 9 pages into the section on the SERIN statement. It mentions something called a "Qualifier". This will probably do what you need.
  • scary terryscary terry Posts: 24
    edited 2008-03-21 17:26
    Thanks for the reply Mike. I looked at "qualifier" earlier but didn't think it would meet my needs but I intend to try it soon. I actually attempted to try it last night but ran into another problem. I don't know if I'm overlooking something or just being stupid, but I couldn't get this line of BS1 code, "SEROUT 0, N2400, ("VPF new.mp3", CR)", past the syntax check on the editor. It says the CR needs to be a constant or variable. Can the BS1 handle a carriage return? There's even this example, "SEROUT 1, N2400, ("HELLO", CR)", in the SEROUT section of the manual. Any idea what I'm doing wrong?
  • Mike GreenMike Green Posts: 23,101
    edited 2008-03-21 18:17
    For some reason, "CR" is pre-defined for the BS2 compiler, but doesn't seem to be predefined in the BS1 compiler (they are separate even though both are included in the Stamp Editor). The simplest thing is just to include a declaration for it: SYMBOL CR = 13.
  • scary terryscary terry Posts: 24
    edited 2008-03-21 19:36
    Thanks again Mike, however.....I just tried what you suggested and I get the message "Symbol name invalid or already defined". Very strange! Any other suggestions?
  • FORDFORD Posts: 221
    edited 2008-03-22 00:53
    Hi Terry,

    Try this...

    SEROUT 0, N2400, ("VPF new.mp3", 13)

    The CR is actually just the value 13. Using CR just makes it more readable.
    Seems you cant use CR·in bs1 programs, only bs2 and up.

    Cheers,

    Chris, West Oz.
  • scary terryscary terry Posts: 24
    edited 2008-03-23 21:50
    Thanks Mike and Chris for your help. The project was successful.
Sign In or Register to comment.