Go Down

Topic: ESP32 HardwareSerial (Read 213 times) previous topic - next topic

Pacpat

Hello,
i have some trouble with esp32 an HardwareSerial!
here my script for testing the Serial....

#include <HardwareSerial.h>
HardwareSerial Myserial(1);
void setup(){
 
   Serial.begin(9600);
   Myserial.begin(9600);
    delay(1000);
    Myserial.println("Hello World");
    Serial.println("Hello World");
}
void loop() {
{


Serialprint run fine It Shoows me pic1


But MyserialPrint shows me some characters.... pic2

I would be glad if someone could help me with this....
Thank
Patrik

GypsumFantastic

What's the baud rate setting in serial monitor?

Pacpat

The Serial Monitor has 9600 baut on both (Serial and MySerial)...

darrob

Try changing
Code: [Select]
Myserial.begin(9600);
to
Code: [Select]
Myserial.begin(9600, SERIAL_8N1, RXD, TXD);[code]
where RXD and TXD are the pins you're using

Pacpat

same resualt... pic :smiley-confuse:

darrob

How do you have it wired up?
Are you using a usb to ttl device?
Provide a schematic/wiring diagram

Pacpat

#6
Nov 09, 2018, 04:03 pm Last Edit: Nov 09, 2018, 04:05 pm by Pacpat
here some pics.....

darrob

#7
Nov 09, 2018, 04:13 pm Last Edit: Nov 09, 2018, 04:15 pm by darrob
That looks like a USB to RS-232 device. I don't think it works in the way you're using it.
You need a USB to TTL device, similar to this. or this.
You can find cheaper ones on ebay I'm sure.

Idahowalker

Also, for the DUE and the ESP32, I found that a Serial.flush() after the end of a serial print sequence helps rid those funky printer characters.

Go Up