I'm currently trying to communicate my ESP32 DevKitV1 through serial. I bought a TTL-RS232 like this one:
https://es.aliexpress.com/store/product ... st=ae803_4
So I wired it to the ESP32 like this: This is my code:
- #define RXD2 16
- #define TXD2 17
- void setup() {
- // Note the format for setting a serial port is as follows: Serial2.begin(baud-rate, protocol, RX pin, TX pin);
- Serial.begin(115200);
- //Serial1.begin(9600, SERIAL_8N1, RXD2, TXD2);
- Serial2.begin(115200, SERIAL_8N1, RXD2, TXD2);
- Serial2.println("serial2test");
- Serial.println("Serial Txd is on pin: " + String(TX));
- Serial.println("Serial Rxd is on pin: " + String(RX));
- }
- void loop() {
- Serial2.print("hello");
- Serial2.write("hellowrite");
- Serial.print(char(Serial2.read()));
- delay(1000);
- }
Am I missing something? Should I not be crossing the TX/RX pins?