I am using the software serial library to use the bluetooth module hc-05 with arduino UNO.
I am using a old code that worked in the past
'''#include <SoftwareSerial.h>
int state = 0;
void setup() {
Serial.begin(9600); // Default communication rate of the Bluetooth module
}
void loop() {
if(Serial.available() > 0){ // Checks whether data is comming from the serial port
state = Serial.readString()[0]; // Reads the data from the serial port
String st = "------------- Received: "+Serial.readString();
Serial.println(st);
} else {
'''
I upload the code without connecting tx rx wires and after uploading I reconnect the wires (tx->rx and rx->tx) and connect the bluetooth to the computer, opening the buetooth serial nothing appear but just when I reattach the arduino to the computer and look to the USB serial I read all the data. I don't understand why. Someone can help me???
4. Enter A in the InputBox of SM and check that it has appeared on BT terminal of your phone. 5. Enter A in the BT terminal of your phone and check that it has appeared on OutputBox of SM.
The bluetooth is connected to arduino as following:
Vcc->3.3V
GND->GND
TX->D0(RX)
RX->D1(TX)
I didn't create any object because I should use directly the serial, I also tried to create the software serial object by using the pin D11 and D12 but they didn't work anyway.
The LED when connected to computer is flashed correctly as you say
I am looking directly to the HC-05 serial port