Read character out of a serial port
Luis_P
Posts: 246
in BASIC Stamp
Do anybody know any code for the Basic Stamp2 to read characters out of a serial port of a USB host I have? The USB host its connected to a keyboard and when a key is pressed sends characters out (TX) to the stamp2 (RX). 9600 baud.
I need a Serin code to start with.
Please help!
Here is the link of the USB host with an Arduino example:
http://www.hobbytronics.co.uk/usb-host/usb-host-keyboard
I need a Serin code to start with.
Please help!
Here is the link of the USB host with an Arduino example:
http://www.hobbytronics.co.uk/usb-host/usb-host-keyboard
Comments
SERIN <pin>,84,[c]
where c is defined as a byte or word variable. Read the chapter on the SERIN statement in the Basic Stamp Syntax and Reference Manual for details.
Thanks Mike. I little confused about baud. It should be inverted? (Im not sure what that is). Is this OK to use for the baud begining code?:
#SELECT $STAMP
#CASE BS2
T9600 CON 84
#END SELECT
THANKS YOUR YOUR HELP.
Luis
The #SELECT statement you showed is used to adjust the Baud constants for different Stamp models. If you're only going to be using one Stamp model, you can leave that out. You could either use
T9600 CON 84
or
Baud CON 84
and use that name in your SERIN and SEROUT statements