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