I am trying to read data from serial to use port on pc

66 Views Asked by At

I am trying to read data from the serial to use port on pc

  useEffect(() => {
        const port = new SerialPort(PortName, { baudRate: BaudRate }, (err: any) => {
            if (err) {
                console.error('Error opening port:', err);
            } else {
                console.log('Serial port opened successfully.');
            }
        });

I am getting error as This expression is not constructable. Type 'typeof import(/node_modules/serialport/dist/index) has no construct signatures.

  useEffect(() => {
        const port = new SerialPort(PortName, { baudRate: BaudRate }, (err: any) => {
            if (err) {
                console.error('Error opening port:', err);
            } else {
                console.log('Serial port opened successfully.');
            }
        });
0

There are 0 best solutions below