Bluetooth Interfacing with Arduino
What is Bluetooth?
Bluetooth is a standardized protocol for sending and receiving data via a 2.4GHz wireless link.
It's a secure protocol, and it's perfect for short-range, Low-cost, Low-power, wireless transmission between electronic devices.
Image of Bluetooth(HC-05 module):-
Connection of Bluetooth module With Arduino.
Pin 1. Vcc:- It is connected to the 5v pin on the Arduino board.
Pin 4. RX:- It is used to receive the serial data and is connected to the TX pin of the Arduino
Task 1: To display a message on a Serial monitor using Bluetooth.
Code:-
void setup ()
{
Serial.begin(9600);
}
void loop()
{
if (Serial.available()>0)
{
String ch =Serial.readString();
Serial.println(ch);
}
}
Output:-
Task 2: To display a message on a LCD using Bluetooth.
Code:-
#include<LiquidCrystal.h>
LiquidCrystal lcd(13,12,5,4,3,2);
void setup ()
{
lcd.begin(16,2);
Serial.begin(9600);
}
void loop ()
{
if (Serial.available()>0)
{
lcd.clear();
String ch = Serial.readString();
lcd.setCursor(0,0);
lcd.print(ch);
delay(1000);
}
}
Output:-
0 Comments