Page 1 of 1

How to use serial port?

Posted: Aug 22nd, '18, 18:53
by cat3282828
Hi...

Would anyone help me, how to use serial lib?
Any example?

Thank you very much,

cat3282828

Re: How to use serial port?

Posted: Sep 1st, '18, 17:32
by JohnM
Here are the built-in GP serial port functions:

-- Serial Port --
listSerialPorts
openSerialPort
isOpenSerialPort
closeSerialPort
readSerialPort
writeSerialPort

I got this by running the 'help' function in a workspace window. (To open a workspace, first enter developer mode, then select 'workspace...' from the stage menu.)
Screen Shot 2018-09-01 at 1.37.38 PM.png
This gave me a long list of built-in functions. You can scroll down to find the serial port functions.

You can use the 'help' function with the name of a built-in function in a workspace like this:
Screen Shot 2018-09-01 at 1.40.53 PM.png
That opens a new window that says what the function does:
Screen Shot 2018-09-01 at 1.36.47 PM.png
A good way to learn about the serial port is to plug some device into the serial port and experiment with the serial port blocks.

I hope that helps!