Unknown Output Characters in Arduino

77 views Asked by At

I am actually connecting my laptop and arduino using FPVDrone 3DR Radio Telemetry. My connection is

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

while my FPV ground module is connected to my laptop. I have an app running using node JS with the following script

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

and my arduino code is

void setup() {

  Serial.begin(57600);

}

void loop() {

  if (Serial.available()) {

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

    delay(10);

  }

}

i'm pretty sure they are communicating because my arduino is receiving some output, however the output is some characters i dont know,

arduino output

can someone please tell me what I should do so that i can receive the string "hello" to my arduino?

2

There are 2 answers

0
Salix alba On

Try setting the baudrate in the node.js script

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

characters get messed up is the sending and receiving baudrates are different.

0
emersonblima On

Are sure that the characters sent to the Arduino are ASCII code? If you are sending integers and they are below 0x30, then they are non-printable characters and you will see gibberish. Make sure that you send an ASCII symbol or use/make a terminal that can show the raw integers.