Hello all. Me and my Bluetooth module (HC-05 6Pin) are not getting friends. In short: The module works on my Arduino Uno R3 without problems. Unfortunately I can't get the module to work on my Arduino Mega where i need it. I pluged the cables in both Arduinos in the same slots. I tried additionally TX1 and RX1, but it didn't work.
Behavior on the Arduino Mega:
Cell phone connects to module and LED on HC-05 flashes slowly evenly as it should. Transmitted data are not printed in the Serial Console. There is simply no output. Are there any differences between the two boards? Does someone have any ideas? Thanks to all who read this. Ask if you need more informations.
Both Arduinos were tested by 12V battery and USB 3.0 and only USB 3.0
Arduino Uno Pinout:
HC-05/Arduino Uno
RXD => 2 (Digital Pin)
TXD => 3 ~ (Digital Pin)
GND => GND
VCC => 5V
Arduino Mega Pinout:
HC-05/Arduino Mega
RXD => 2 (Digital Pin)
TXD => 3 (Digital Pin)
GND => GND
VCC => 5V
Code:
#include "Arduino.h"
#include <SoftwareSerial.h>
const byte rxPin = 3;
const byte txPin = 2;
SoftwareSerial BTSerial(rxPin, txPin);
void setup(){
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
BTSerial.begin(9600);
Serial.begin(9600);
}
void loop() {
if (BTSerial.available()) {
Serial.write(BTSerial.read());
}
if (Serial.available()) {
char ch=Serial.read();
BTSerial.write(ch);
}
}