I am trying to get an HC-05 bluetooth module to work with an Arduino Micro.
Basically, I can send information from my desktop, and it is received/displayed on my phone. Sending from my phone to the arduino bluetooth doesn't work.
Below is the details. I will post some code and photos of the configuration shortly. Thank you for your time!
--
The Arduino is connected to my linux desktop.
Configuration:
Linux desktop, using Arduino IDE
Arduino Micro connected by USB to Desktop
Bluetooth module connected to Arduino
Arduino 5V -> Bluetooth VCC
Arduino Ground -> Bluetooth Gnd
Arduino Pin 2 (set as RX) -> Bluetooth TX
Arduino Pin 3 (set as TX) -> Bluetooth RX
Arduino Software Serial to use pins 2 and 3
What Works:
- I can pair with the HC-05 bluetooth with my phone or other bluetooth capable devices
- I can use the serial monitor, or another com program on my desktop to SEND information that is received by the bluetooth device and displayed (Arduino TX -> Bluetooth RX)
What doesn't work:
- Sending information from bluetooth device to Arduino, either trying to turn a light on or off on the arduino, or seeing the input in a com program on the desktop.
What I tried:
- Connecting bluetooth to 3.3v on arduino
- Using resistors to pull down the TX and RX lines to 3.3v
- Connecting the bluetooth module to an FTDI adapter directly to my desktop, with same results.
Here is the code I copied from somewhere:
#include <SoftwareSerial.h>
#define rxPin 2
#define txPin 3
SoftwareSerial mySerial(rxPin, txPin); // RX, TX
char myChar ;
void setup() {
Serial.begin(9600);
Serial.println("Goodnight moon!");
mySerial.begin(9600);
mySerial.println("Hello, world?");
}
void loop(){
while(mySerial.available()){
myChar = mySerial.read();
Serial.print(myChar);
}
while(Serial.available()){
myChar = Serial.read();
mySerial.print(myChar);
}
}