How To Make Two ARDUINO Boards Bluetooth Communicate With Each Other

This tutorial will show you how to use a HC-05 And A HC-06 with your ARDUINO boards to send data between them via Bluetooth connection.

Click on video below for full tutorial…

 

Parts List:

ARDUINO BOARD

HC-05

HC-06

Logic lvl Converters

 

ARDUINO CODE:

 

HC-05 Master board code:

int val;
#define button 3
void setup() {
Serial.begin(9600);
pinMode(button, INPUT);
}

void loop() {
val = digitalRead(button);
if (val == HIGH)
{
Serial.write(100);
delay(500);
}
delay(50);
}

 

HC-06 Slave Board Code:

 

#define led 2
int pos = 0;
int val;
void setup() {
Serial.begin(9600);
pinMode(led,OUTPUT);

}

void loop() {
if(Serial.available() > 0)
{
val = Serial.read();
if (val==100 && pos==0)
{
digitalWrite(led,HIGH);
pos = 1;
}
else if(val==100 && pos==1)
{
digitalWrite(led,LOW);
pos = 0;
}

}

}

Advertisements