Assistance receiving ESP32 Bluetooth commands from react app to Arduino IDE serial monitor

Hello community. I am a professional artist/designer who has taken up robotics as a hobby. The robot is called Peanut. I am trying to control Peanuts movements via react app. I am able to successfully pair my ESP32 device with the app. When the Move Forward button is pressed, “craw_forward” should be transmitted and received in the serial monitor for debugging. After receiving a successful connection status in the monitor, nothing else happens. “Crawl_Forward” should be printed in the serial monitor but is not. Below are the GitHub links. Any assistance is gladly appreciated.

The GitHub links are missing.

I found your code on Github and converted it into a PlatformIO project.
I then tested it with my smartphone and the nRF Connect app:

The code works perfectly.

What I noticed:
Forwarding the commands to Serial2 will not work.

Reason: Serial2 is not initialized

Oh wow. Thank you so much for your assistance! I will test it out asap. So far, I am able to transmit “crawl_forward” from my react app to my ESP32 and view it in the serial monitor. However, there is no data whatsoever being printed in the serial monitor via Arduino mega serial port. I will test out your method and see if it works for me.Thank you again!

I got it wrong. I had understood that the ESP32 does not display anything in the serial monitor.

In the sketch of the ESP32 a simple addition of Serial2.begin(baudrate); should suffice, where boudrate must match the boudrate of the Arduino Mega.

Apologies for the delay. I believe you understood it right. Initially when I posted the question, I was able to establish a successful connection but wasn’t able to transmit Bluetooth command “crawl_forward”. Your advice worked in that I needed to initialize serial12.begin(baudRate). Now I just have to figure out why the servos aren’t moving. Im confident I will resolve that problem soon. Thank you for all your help!

Serial2.println("crawl_forward"); will output crawl_forward\r\n to the serial2.

You must trim the received String and remove \r and \n from the received string before performing the comparison to “crawl_forward”.

Thanks again! I’ll test it out later today.