Answer the question
In order to leave comments, you need to log in
How to pass data from COM port to JS?
Good day! Based on the values of the accelerometer, I want to build a 3D model in the browser (WebGL). Stmka is connected to the COM port, I read the values using the jSSC java library. How to beautifully then pass the read values to JS in order to build a 3D model? Thank you.
Answer the question
In order to leave comments, you need to log in
The JS runtime in the browser is isolated from the hardware, so a full-fledged implementation of a client-server application is needed here.
A computer with a COM port will act as a web server.
On this server, you need to implement a server script that will connect to COM and will transit over HTTP with a client - browser.
And already on the client side, the API will be implemented using JS, and receiving data - AJAX.
Here is an example of how to make the server side in NodeJS.
There is such an option. Create a server in python'e there, accept data from the COM port, the page will take them with Ajax .... well, here, as it were, all the options will not be very realtime. You can also fasten the ESP8266 to stm, on it is a web server with data from the accelerometer, the page in the browser will already haw this all with Ajax
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question