Trying to read data with experimental feature from chrome (serial port) but code freeze on await data

Viewed 21

I'm trying to use serial port, experimental feature from google chrome with reactjs. I do the connection with a digital balance (https://www.toledobrasil.com/blob/products/5_image1566803343.jpg) but the function freeze when wait for any data.

await port.open({
      baudRate: 9600,
      dataBits: 7,
      stopBits: 1,
      parity: "none",
    });
const _reader = port.readable.getReader();
while (true) {
      const { value, done } = await _reader.read(); //the execution freeze here
      console.log({ value, done }); //this line never is executed because the await above never return
    }
0 Answers
Related