Bluetooth module hc-05 with Arduino

Bluetooth module hc-05 with Arduino

In this tutorial we will learn how we can connect bluetooth module hc-05 with arduino.
Watch the Video carefully.

Source Code:

#include<SoftwareSerial.h>

#define TxD 3
#define RxD 2
#define LED_PIN 13

SoftwareSerial bluetoothSerial(TxD, RxD);

char c;

void setup() {
  bluetoothSerial.begin(9600);
  Serial.begin(9600);
  pinMode(LED_PIN, OUTPUT);
  }

void loop() {
  if(bluetoothSerial.available()){
    c = bluetoothSerial.read();
    Serial.println(c);
    if(c=='1'){
      digitalWrite(LED_PIN, HIGH);          
    }
    if(c=='0'){
      digitalWrite(LED_PIN, LOW);
    }
  }
}
Bookmark the permalink.

2 Comments

  1. Pingback: Bluetooth Remote Sprayer Control - The Combine Forum

  2. Thanks a lot mate, it helped me go right to the point. I’ll keep surfing on your blog for more about arduino’s. I’m a teacher in middle year school and your cooperation is most appreciated.

Leave a Reply

Your email address will not be published. Required fields are marked *