Hello there,
I have an HTML script using a button to call my function to close serial port onclick.
<button onclick="closePort()">Close Port</button>
....
....
....
<script>
function closePort() {
var portName = document.getElementById('ix-dd-com').value;
socket_.emit('command', 'close ' + portName);
}
</script>
This will take about 1.5 to 2 seconds later before the web socket will notify me that my COM3 serial port has been successfully closed. Whereas for opening of serial port, the websocket's response is almost instantaneous.
This is kind of frustrating because when it comes to changing the baud rate of the serial port. The agent will attempt to open the same serial port with a different baud rate before it closes.
I've attached the codes. it's an HTML script using JavaScript and socket.io. Really appreciate if anybody can help me out here. Thanks.
EDIT 1: Arduino forum doesn't allow uploading files in .HTML format. So I re-upload in .txt instead.
myIndex.txt (4.11 KB)