Introduction: Controlling Arduino UNO Via Smart Phone Using HC-05 Bluetooth Module
Controlling Arduino UNO via Smart Phone using HC-05 Bluetooth Module.
Step 1: Initial Setup
Components Needed:
- Arduino UNO
- Arduino Cable ( In order to connect your arduino to computer)
- HC-05 Bluetooth Module
- LED
- 1 Resistor 450 Ω to 1KΩ (any)
- Bread Board
- Arduino Desktop App ( In order to compile your code to arduino board )
- Yes Of course some couple of wires.
Source Code:
char data = 0; //Variable for storing received data
void setup() { Serial.begin(9600); //Sets the baud for serial data transmission pinMode(13, OUTPUT); //Sets digital pin 13 as output pin } void loop() { if(Serial.available() > 0) // Send data only when you receive data: { data = Serial.read(); //Read the incoming data & store into data Serial.print(data); //Print Value inside data in Serial monitor Serial.print("\n"); if(data == '1') // Checks whether value of data is equal to 1 digitalWrite(13, HIGH); //If value is 1 then LED turns ON else if(data == '0') // Checks whether value of data is equal to 0 digitalWrite(13, LOW); //If value is 0 then LED turns OFF } }