Hardware:
- Arduino: Arduino Uno
- Bluetooth Module: HC-05 (ZC-040)
Problem: I'm having trouble connecting my HC-05 Bluetooth module to my Windows 10 computer. The computer can find the device, but it fails to establish a connection. I've double-checked the wiring and the code, but I'm still facing issues.
Current Setup:
- Connections:
- HC-05 TX -> Arduino pin 2 (RX)
- HC-05 RX -> Arduino pin 3 (TX)
- HC-05 VCC -> 5V
- HC-05 GND -> GND
#include <SoftwareSerial.h>
#define RX_PIN 2 // RX pin of BlueTooth Module connected to pin number 2 on the Arduino
#define TX_PIN 3 // TX pin of BlueTooth Module connected to pin number 3 on the Arduino
SoftwareSerial Slave(TX_PIN, RX_PIN);
char BluetoothData; // Initialize BluetoothData variable
void setup() {
Serial.begin(19200); // Serial communication at 19200 baud
Slave.begin(9600); // SoftwareSerial communication at 9600 baud
}
void loop() {
// Check if data is available from Bluetooth module
if (Slave.available()) {
BluetoothData = Slave.read(); // Read the incoming data
Serial.println(BluetoothData); // Print the incoming data to serial monitor
}
}