Arduino h05 bluetooth module

hi … i am using the h05 bluetooth module i wanted to start with a simple code to test the module but i am having some troubles on uploding the code on the board knowing that the arduino board works perfectly without this module.
here’s he code that i am using:
code

Which pins is the HC05 connected to ?

Not 0 and 1 by any chance ?

What Bluetooth device is communicating with the HC05? Is the HC05 paired with that device? What app on the device is communicating with the HC05? Is the HC05 connected with the app?

To start with experimenting with the HC05 you are better off using a software serial port for the HC05 and saving the hardware serial (pins 0 and 1, USB) for program upload and monitoring program flow and variable values. Once you have everything working to satisfaction, change to hardware serial.

Start simple and make sure the communication works before adding other stuff.

Here is my test code to test the connection between the Bluetooth device and the Arduino with HC05 installed. For the Bluetooth app I use Bluetooth Serial Terminal running on my tablet.

#include <SoftwareSerial.h>

// Change these pins to what works for you.
// and connect the BT device to those pins
// BT RX to Arduino TX through voltage divider, BT TX to Arduino RX
SoftwareSerial btSerial(4, 7); // RX, TX

void setup()
{
   Serial.begin(9600);
   btSerial.begin(9600);  // HC05 defaults to 9600 baud
   Serial.println("Arduino ready");
}

void loop()
{
   // if something comes from serial monitor send it to the Bluetooth device
   if(Serial.available())
   {
      btSerial.print(char(Serial.read()));
   }

   // if the Bluetooth device sends something print it in serial monitor
   if(btSerial.available())
   {
      Serial.print(char(btSerial.read()));
   }
}


What ever you type and send from serial monitor should show up in the app and what you type and send from the app should show in serial monitor.

If you want to use the hardware serial pins (0 and 1) with the HC05, then the module must be disconnected from those pins when uploading code.

yes it worked for me … i disconnected the pins 0 and 1 and it’s working perfectly noww …thankx for your help :grinning: u made my day

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