Arduino
The Bluetooth module have two different model, HC05 and HC06. The difference is the former can be set to Master or Slave, and the later can only be the Slave.
HC05/6 use the softwareSerial to communicate with Arduino board(just like the way Arduino communicate to PC). The pin can set connect to any teo digitalpins only not using D0 & D1. In the example, I use D9 & D10.
Here is a simple code to test the connection between Arduino and HC05. Download controller app and open Bluetooth on your phone. Next, find HC05 and connect to it. The password could be 0000 or 1234. Then go to the app and tap the HC05 to connect it using Terminal mode. Now you can type letter and send to Arduino.
#include <SoftwareSerial.h>
SoftwareSerial BT(9, 10);
//BT(RX pin, TX pin)
//TX on Arduino need to connect to RX on HC05, and so as RX on board an TX on HC05
void setup(){
Serial.begin(9600);
BT.begin(9600);
}
void loop(){
if(Serial.available()){
char a = Serial.read();
BT.println(a);
}
if(BT.available()){
char b = BT.read();
Serial.println(b);
}
delay(100);
}