How to use serial port?

Post your nifty GP projects here!

Moderator: MSandro

Post Reply
cat3282828
Posts: 1
Joined: Nov 23rd, '17, 06:33

How to use serial port?

Post by cat3282828 » Aug 22nd, '18, 18:53

Hi...

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

Thank you very much,

cat3282828

JohnM
Posts: 379
Joined: Sep 11th, '15, 14:42

Re: How to use serial port?

Post by JohnM » Sep 1st, '18, 17:32

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!

Post Reply