SerialPort/Angular 在读取其消息后向串行端口发送指令

问题描述 投票:0回答:1

我在我的角度项目中使用了“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)
  }

有什么建议吗?

angular electron serial-port
1个回答
0
投票

https://bard.google.com/chat/f2a13ae41315cbe7

请查看链接可能对您有帮助

© www.soinside.com 2019 - 2024. All rights reserved.