Shop OBEX P1 Docs P2 Docs Learn Events
Serin with USB — Parallax Forums

Serin with USB

nickrummelnickrummel Posts: 13
edited 2010-12-01 21:00 in BASIC Stamp
Hello,
I'm trying to use Matlab to run my basicstamp program and just learning about the Serin/Serout commands. I found the sample program for Serin:
' {$STAMP BS2}
' {$PBASIC 2.5}


SERIN 1, 16468, [WAIT("SESAME")]
DEBUG "Password accepted"
END

However, when I run it nothing happens when I type SESAME...
Does the Serin command work with USB connections?

Thanks

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-12-01 21:00
    The program you showed uses I/O pin #1 for its input. You can attach a logic-level serial input to I/O pin #1 and the program will work, but that's probably not what you want.

    If you have a USB Board of Education or a serial Board of Education with a USB to Serial adapter, you can use a pin number of 16 in your SERIN statement. As explained in the Stamp Manual, there is no I/O pin #16, but Stamp Basic uses 16 to specify that the SERIN should use the programming serial port (SIN/SOUT) for the SERIN input. You can also use 16 in a SEROUT statement to send data to the PC over the serial port. Also look at the DEBUG and DEBUGIN statements which also use the programming serial port. They're really special forms of the SEROUT and SERIN statements.
Sign In or Register to comment.