Arduino: How can I display Bluetooth input on Serial Monitor?

Viewed 25

I am using an Arduino UNO R3 and an HC-05 bluetooth module. It connects to the TX and RX ports. This blocks me from using a Serial Monitor on my PC. I tried code that is supposed to use PWM pins (10; 11) for the bluetooth module (and also added the library). Still, my Serial Monitor stays completely empty. Is there any fix or any other method? Thanks a lot.

 /*


Modified on March 09, 2021
  Modified by MohammedDamirchi from https://github.com/PaulStoffregen/SoftwareSerial
  
Home

*/


#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX, TX

void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  // set the data rate for the SoftwareSerial port
  mySerial.begin(9600);
}

void loop() { // run over and over
  if (mySerial.available()) {
    Serial.write(mySerial.read());
  }
  /*if (Serial.available()) {
    mySerial.write(Serial.read());
  }*/
}
0 Answers
Related