How to communicate between React CRA website and Arduino via Serial

As the title says, I have a React "Create-React-App" project, run with npm. It is a flight data website.

The current setup is that it communicates with a Java WebSocket server. Previously, an Android app communicated with this WebSocket server and sensors would communicate with the phone to get to the website.

Now, I have replaced the phone with an Arduino Nano to reduce latency, and I’m wondering what the best pathway between the React project and a USB-plugged-in Arduino is. Obviously the Arduino has to communicate via serial. I have tried using the node serialport package in the React project but it does not work, as detailed here:

One succesful pathway I’ve found is Arduino -> Python script that can read and write to serial, read and write as a Websocket Client -> Java Websocket Server -> React app.

I chose Python because it is my main language, whereas the Java server and React app are legacy code. The problem with this implementation is that I need 4 IDEs (Arduino, Python, Java, React) to develop and I have to run each package separately, so it is not convenient.

I’m looking for a shorter path. The Java server can die, but the React app and Arduino cannot. Any advice?

Source: React – Stack Overflow

August 19, 2021
Category : News
Tags: arduino | network-programming | reactjs

Leave a Reply

Your email address will not be published. Required fields are marked *

Sitemap | Terms | Privacy | Cookies | Advertising

Senior Software Developer

Creator of @LzoMedia I am a backend software developer based in London who likes beautiful code and has an adherence to standards & love's open-source.