Devices & Components
Arduino Uno Rev3
Breadboard (generic)
HC-05 Bluetooth Module
Jumper wires (generic)
9V battery (generic)
5 mm LED: Red
Project description
Code
Bluetooth HC05 Test
arduino
The code below is used to test your bluetooth connectivity.
1#include <SoftwareSerial.h> 2SoftwareSerial BTserial(2, 3); 3int ledPin = 12; 4char data = 0; 5 6void setup() 7{ 8 pinMode(ledPin, OUTPUT); 9 BTserial.begin(9600); 10 // Serial.begin(9600); 11 // serial.println("Hello World"); 12} 13 14void loop() 15{ 16 if (BTserial.available()) 17 { 18 data = BTserial.read(); 19 if(data == '1') 20 digitalWrite(ledPin, HIGH); 21 else if(data == '0') 22 digitalWrite(ledPin, LOW); 23 } 24}
Bluetooth HC05 Test
arduino
The code below is used to test your bluetooth connectivity.
1#include <SoftwareSerial.h> 2SoftwareSerial BTserial(2, 3); 3int 4 ledPin = 12; 5char data = 0; 6 7void setup() 8{ 9 pinMode(ledPin, 10 OUTPUT); 11 BTserial.begin(9600); 12 // Serial.begin(9600); 13 // 14 serial.println("Hello World"); 15} 16 17void loop() 18{ 19 if (BTserial.available()) 20 21 { 22 data = BTserial.read(); 23 if(data == '1') 24 25 digitalWrite(ledPin, HIGH); 26 else if(data == '0') 27 28 digitalWrite(ledPin, LOW); 29 } 30}
Downloadable files
Block Diagram
Block Diagram

Comments
Only logged in users can leave comments