【问题标题】:Unknown Output Characters in ArduinoArduino中的未知输出字符
【发布时间】:2020-03-14 15:06:21
【问题描述】:

我实际上是在使用 FPVDrone 3DR Radio Telemetry 连接我的笔记本电脑和 arduino。我的连接是

ARDUINO tx- FPV Air module rx
ARDUINO rx- FPV Air module tx
ARDUINO 5v- FPV Air module 5v
ARDUINO GND- FPV Air module GND

当我的 FPV 接地模块连接到我的笔记本电脑时。我有一个使用带有以下脚本的节点 JS 运行的应用程序

const SerialPort = require('serialport');
const Readline = SerialPort.parsers.Readline;
const port = new SerialPort('COM3');
port.write('hello');

我的arduino代码是

void setup() {

  Serial.begin(57600);

}

void loop() {

  if (Serial.available()) {

    Serial.print((char) Serial.read());

    delay(10);

  }

}

我很确定他们正在交流,因为我的 arduino 正在接收一些输出,但是输出是一些我不知道的字符,

arduino output

谁能告诉我我应该怎么做才能收到字符串“hello”到我的arduino?

【问题讨论】:

  • 什么时候将笔记本电脑的端口初始化为 57600 波特?我看不到初始化。

标签: node.js arduino serial-port 3dr


【解决方案1】:

尝试在 node.js 脚本中设置波特率

const port = new SerialPort(path, { baudRate: 57600 })

字符弄乱是发送和接收波特率不同。

【讨论】:

    【解决方案2】:

    确定发送到 Arduino 的字符是 ASCII 码吗? 如果您发送整数并且它们低于 0x30,那么它们是不可打印的字符,您会看到乱码。 确保您发送一个 ASCII 符号或使用/制作一个可以显示原始整数的终端。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-12-15
      • 2010-09-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多