General Discussions
Serial communication

I created a SerialStream in the screen's script, and the serial port can open successfully. But when I use Sersend to send data, the data isn't sent immediately—it only gets sent when I switch screens or close the project. What method should I use to force flush the send buffer?

Here's the script I tested:
Main [
Return(Self);

If Watch(0,Creat);
[
streamHandle = SerialStream(3 { COM3: },
1024 { Buffer 1024 bytes of received data },
1024 { Buffer 1024 bytes of transmitted data },
9600 { Baud rate },
8 { Data bits per byte },
1 { Stop bit per byte },
0 { No parity bit },
1 { Force RTS on },
0 { No Software flow control (XonXOff) },
3 { Control: DTR On, CTS control enabled });
]

isvalue = Valid(streamHandle);

If Watch(0,K);
[
sends = SerSend(3, "hello word ", 12, 0);
]
]

Thanks for answering me

I created a SerialStream in the screen's script, and the serial port can open successfully. But when I use Sersend to send data, the data isn't sent immediately—it only gets sent when I switch screens or close the project. What method should I use to force flush the send buffer? Here's the script I tested: Main [ Return(Self); If Watch(0,Creat); [ streamHandle = SerialStream(3 { COM3: }, 1024 { Buffer 1024 bytes of received data }, 1024 { Buffer 1024 bytes of transmitted data }, 9600 { Baud rate }, 8 { Data bits per byte }, 1 { Stop bit per byte }, 0 { No parity bit }, 1 { Force RTS on }, 0 { No Software flow control (XonXOff) }, 3 { Control: DTR On, CTS control enabled }); ] isvalue = Valid(streamHandle); If Watch(0,K); [ sends = SerSend(3, "hello word ", 12, 0); ] ] Thanks for answering me

Have you opened this page in the source debugger and created some break points. You can hover over your variables to see their values and step through your code.

You can find a quick intro to the Source Debugger here: https://www.youtube.com/watch?v=8LKAKjEFWds&t=147s

Have you opened this page in the source debugger and created some break points. You can hover over your variables to see their values and step through your code. You can find a quick intro to the Source Debugger here: https://www.youtube.com/watch?v=8LKAKjEFWds&t=147s

Trihedral Engineering Ltd.

14
1
2
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft