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 ?
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.
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)
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.