ARDUINO BLUETOOTH BASIC TUTORIAL

ARDUINO BLUETOOTH BASIC TUTORIAL

63,005
690
46

Introduction: Arduino Bluetooth Basic Tutorial

Picture of Arduino Bluetooth Basic Tutorial
Ever thought of controlling any electronic devices with your smart phone ?Controlling your robot or any other devices with your smartphone will be really cool. Here is is a simple and basic tutorial for interfacing Bluetooth with arduino

Step 1: Things You Need

Picture of Things You Need

Hardware

Software

Step 2: Watch How Does It Works ?

Picture of Watch How Does It Works ?
Watch the video tutorial

Step 3: Let’s Start Building

Picture of Let’s Start Building
The circuit is so simple and small , there is only few connection to be made
Arduino Pins___________Bluetooth Module Pins
RX (Pin 0)___________________TX
TX (Pin 1)___________________RX
5V_________________________VCC
GND_______________________GND
Connect a LED negative to GND of arduino and positive to pin 13 with a resistance valued between 220Ω – 1KΩ. And your done with the circuit
Note : Don’t Connect RX to RX and TX to TX of Bluetooth to arduinoyou will receive no data , Here TX means Transmit and RX means Receive

Step 4: Upload the Code

/* Bluetooh Basic: LED ON OFF - Avishkar
* Coder - Mayoogh Girish
* Website - http://bit.do/Avishkar
* Download the App : https://github.com/Mayoogh/Arduino-Bluetooth-Basic
* This program lets you to control a LED on pin 13 of arduino using a bluetooth module
*/
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 and store it into variable data
      Serial.print(data);          //Print Value inside data in Serial monitor
      Serial.print("\n");          //New line
      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
   }
}

ความคิดเห็น

โพสต์ยอดนิยมจากบล็อกนี้

Pic1

Arduino Real Time Clock Tutorial using DS1307

DHT11 Humidity Sensor on Arduino