I am trying to get a reading from a weighing scale which communicates through RS-232 serial communication, value into a web application using WebUsb API. I am getting the data but after decoding it is coming like this �
. I am getting the correct data in the serial terminal.
Here is the code for the data.
`navigator.usb.requestDevice({ filters: []})
.then((requestedDevice) => {
device = requestedDevice;
}).then(() => {
console.log(device);
return device.open();
}).then(() => device.selectConfiguration(1)) // Select configuration #1 for the device.
.then(() => {
return device.reset();
}).then(() => device.claimInterface(0))
.then(() => {
return device.transferIn(1, 16)
})
.then((data) => {
console.log(data)
console.log(new TextDecoder().decode(data.data));
}).catch(err => {
console.log(err);
}); `
Am I missing something regarding this. is it the baud rate setting, i know the baud rate is 9600 but how to set it here.
Please Help.