Serial CHOP and Dat nodes "how to"

I have no clue how to receive\send serial information.
Anyone can publish example for dat and chop serial nodes ?
is it ASCII or binary commands that i need to use ?

I have some guide for the hardware… not sure what to do :
yeitechnology.com/sites/defa … ar2014.pdf

Year ago I used their python API, we found out they have lots of bugs
(with N sensors), the company told me to try and use serial connection.

Help
Barak.

Hi barakooda.
As a rough start, don’t use the Serial CHOP nodes, they are limited in what they can do.

You’d begin by first configuring the device to output ascii formatted serial messages (not sure how thats setup, or if its automatic).

Place a Serial DAT, and select the COM port to whichever port appears on the windows desktop when the device is plugged in. The other parameters likely work as default.
Important one is: “One Message Per Line”.

This will execute the ‘recevive’ callback in the attached callbacks DAT once for every newline or null terminated message you receive.

You’ll have to parse the responses yourself using basic string parsing methods.
You’ll have access to the received message in either the ‘messasge’ or ‘bytes’ parameter identically, since they don’t contain any binary data.

Start with a simple: print(message) in that callback to ensure you’re getting data.

To send data,use the send or sendBytes methods for the DAT.
They are nearly identical except the former automatically appends terminator characters to your data and expects strings.

You could try:

op(‘serial1’).sendBytes(“>0,0\n”) for example, from section 4.3.7 of the linked pdf

Hopefully the result will be received and printed with your above receive() callback.

Hope thats a good start.

Cheers
Rob.

You meant One row per line ? (i guess this one)
or
one row per message ?

“One Message Per Line”"
not exist.

SOLVED,WORKING.

Big Thanks !

Barak

Hey that’s great!
One Row Per Line is what I meant.

You may consider using an Execute DAT to sendBytes once per frame, as the script DAT may not cook at the times you expect it.

Cheers
Rob

Is it possible to receive two messages one per line (one from each sensor) in the same serial ?
or combine all in one string ?
without reduce the data transmission rate…

currently both sensors sends information and its overlapping .
what the general solution for that?
(i`m also check the the streaming method)

Confused though, how do you tell which data belongs to which sensor?
Are they both coming from COM5?
Is it by what you send in the sendBytes command?

You could have the Serial Callback just populate a second table for every message,
and use expressions to pull out the right cell values.

You could also have the script that sendsBytes clear the serial DAT,
so you know which of the two rows belongs to which of the two sensors.

That will update once per frame/cook, using the last received message.

Yes,two sensors wirelessly connected to the dongle.
thank you! I will try.

Could you post an example of Python code that clears the serial DAT ? I tried op(‘serial’).clear() but then there’s an error message saying the operator is not editable. Using op(‘serial’).clear does nothing but no error either.

Found it: op(‘serial’).par.clear.pulse(), where ‘serial’ is the name of the serial node, will do the job.