The code below used to work a few months ago. I cloned my repo and now it seems there’s a problem:
Unhandled Rejection (TypeError): Failed to execute 'open' on 'SerialPort': required member baudRate is undefined.
async function getPortAndStartReading() {
if (!portFound) {
const port = await navigator.serial.requestPort()
> await port.open({ baudrate: 9600 })
reader = port.readable.getReader()
outputStream = port.writable
readLoop()
if (port) {
// successful connection
}
}
}
What could the problem be here?
Source: Ask Javascript Questions
One Reply to “Web Serial API – Unhandled Rejection (TypeError): Failed to execute ‘open’ on ‘SerialPort’: required member baudRate is undefined”
The “baudRate” is required not “baudrate”
await port.open({ baudRate: 9600 })