Connect Arduino Uno with ESP32

Hi,

I am trying to send some very simple data from my Arduino Uno to an ESP32 and back again.
All I really need, is a very simple way of letting these two devices communicate.

I have seen some Youtube videos and read some articles, but they all seem a bit lacking. Does anyone know how to achieve two way communication between the two devices? Doesnt have to be anything fancy.

This is one of the videos I have watched, with no luck: https://www.youtube.com/watch?v=CaIRigTidVQ

The youtube guy is using an ESP8266, not an ESP32.
SoftwareSerial will not work with ESP32.

Why is the youtube guy placing an external LED on pin 12 instead of using the onboard LED? (The world may never know.)

And then he doesn't use SoftwareSerial on the Uno.

ESP32 (sender) --

const byte RXD2 = 15;  // not needed here, but anyway
const byte TXD2 = 14;

void setup() 
{
  Serial2.begin(9600, SERIAL_8N1, RXD2, TXD2);  // basically any I/O can be used
}

void loop() 
{
  Serial2.print("1");
  delay(2000);
  Serial2.print("0");
  delay(2000);
}

Uno (receiver) --

//
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX, TX

char inChar;

void setup() 
{
  mySerial.begin(9600);
  pinMode(13, OUTPUT);
  digitalWrite(13, LOW);
}

void loop() 
{
  // CORRECTION MADE ↓  ↓  if(Serial.available() > 0)
  if(mySerial.available() > 0)
  {
    inChar = Serial.read();
    if(inChar == '1')
    {
      digitalWrite(13, HIGH);
    }
    if(inChar == '0')
    {
      digitalWrite(13, LOW);
    }
  }
}

I have tried this exact code, but nothing happens. The text isn’t even displayed in the serial. I might have connected the wires wrong. I have connected pin 10 and 11 from the Arduino Uno to pin D14 and D15 on the ESP32.

And then GND to GND, and 3.3V to 3V3

Am I doing something wrong?

that should be --
if(mySerial.available() > 0)

Don't connect their "3V" together.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.