我实际上正在使用 FPVDrone 3DR radio 遥测连接我的笔记本电脑和 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 地面模块连接到我的笔记本电脑时。我有一个使用 Node 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正在接收一些输出,但是输出是一些我不知道的字符,
有人可以告诉我应该做什么,以便我可以将字符串“hello”接收到我的arduino吗?
最佳答案
尝试在node.js脚本中设置波特率
const port = new SerialPort(path, { baudRate: 57600 })
由于发送和接收波特率不同,字符变得困惑。
关于node.js - Arduino 中的未知输出字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58928230/