我在我的角度项目中使用了“ngx-serial”,我想在读取它发送的结果后将一些数据发送到串行端口。我收到这些错误:
这是我的代码:
dataHandler(data: string) {
console.log("From serial port -> " + data);
this.myResult = data.replace(/\r/g, '');;
console.log('myResult: ', this.myResult);
this.readMyStream(this.myResult);
}
readMyStream(data: string) {
setTimeout(() => {
const words = data.split(' ');
if (words[0] === '**' && words[3] === '****') {
this.serial.sendData(`*** ** ****\n`);
console.log('hhihih'); // Alternatively, display message in template
}
}, 9000)
}
有什么建议吗?
https://bard.google.com/chat/f2a13ae41315cbe7
请查看链接可能对您有帮助