Arduino NanoEsp32 serial comunication HC-05 bluetooth module

Hi everyone, i'm developping a system that requires Arduino Nano esp32 ( Nano ESP32 | Arduino Documentation) and need to comunicate via bluetooth as serial port. I can not utilize BLE which is already in this arduino device.
I connected a standard HC-05 bluetooth module to do so but i have some trouble unbderstanding which serial port should i use.

This arduino has 3 serial port right? Serial0 is used for USB comunication (pin D0 and D1 as RX and TX). Serial1 which i should use instead i defined as Ser:

#include "HardwareSerial.h"

const byte RXD2 = 7;
const byte TXD2 = 6; 

HardwareSerial Ser(1); // Use UART channel 1
   
void setup() 
{
  Serial.begin(9600);
  Ser.begin(9600, SERIAL_8N1, RXD2, TXD2);  // D6,D7
  delay(5000);

  Serial.println("OK");

}

void loop() 
{
  Ser.println(millis());
  delay(100);
}

But no message are sent trough the HC-05 to my bluetooth serial port.

Can someone help me?
cheers

Vittorio

have a look at nano-esp32/cheat-sheet section on the UART
it appears

  1. Serial is via the USB-C port
  2. Serial0 is pins D0 Rx and D1 Tx

maybe simpler to get a ESP32 with onboard WiFi, Bluetooth Classic and BLE

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