Programming with HC-05 but nothing show up on terminal

I run the program but nothing show up on terminal but “AT”. And base on what I know HC-05 have basic password is “1234” when purchase but my don’t have password.
Part list: Adruino Uno R3, HC-05
Program:


// code by Martyn Currie.
// To enable AT mode, connect the EN pin of the HC05 
// to 3.3V before powering the HC05.
// Caution, do not connect EN to 5V.

#include <SoftwareSerial.h>
SoftwareSerial BTserial(2, 3); // RX | TX

const long baudRate = 38400;
char c = ' ';
boolean NL = true;

void setup()
{
   Serial.begin(38400);
   Serial.print("Sketch:   ");   Serial.println(__FILE__);
   Serial.print("Uploaded: ");   Serial.println(__DATE__);
   Serial.println(" ");

   BTserial.begin(baudRate);
   Serial.print("BTserial started at "); 
   Serial.println(baudRate);
   //BTserial.print("BTserial started at "); 
   //BTserial.println(baudRate);
   Serial.println(" ");
}

void loop()
{
   // Read from the Bluetooth module and send to the Arduino Serial Monitor
   if (BTserial.available())
   {
      c = BTserial.read();
      Serial.write(c);
   }

   // Read from the Serial Monitor and send to the Bluetooth module
   if (Serial.available())
   {
      c = Serial.read();
      BTserial.write(c);

      // Echo the user input to the main window. The ">" character indicates the user entered text.
      if (NL)
      {
         Serial.print(">");
         NL = false;
      }
      Serial.write(c);
      if (c == 10)
      {
         NL = true;
      }
   }
}

Here is some pictures:



Thanks for your time

Did you do that?

and did you take care to not do that?

Yes I did exactly what you said

Before trying to do this with an Arduino sketch, have you just connected the HC05 to your computer, and verified that it responds to AT commands typed manually via a terminal?

Can you explain how to do this

This is Bd for AT Commands. For data communication, the BT works at Bd = 9600. Try changing the baudRate from 38400 to 9600.

Connect HC05 with UNO using BTserail(2, 3) and a resistor divider (STX (3) ---2.2k---RXPinOfBT---4.7k----- GND) to feed about 3.3V logic at RX-pin of BT.

Upload the following simple sketch (yours one but simplified) and check that you can exchange ASCII coded data with your Android Phone.

#include <SoftwareSerial.h>
SoftwareSerial BTserial(2, 3); // SRX | STX
char ch;

void setup()
{
   Serial.begin(9600);
   BTserial.begin(9600);
 }

void loop()
{
   if (BTserial.available())
   {
      ch = BTserial.read();
      Serial.print(ch);
   }

   if (Serial.available())
   {
      ch = Serial.read();
      BTserial.print(ch);
   }
}

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