Youssef Sabaa
Published

Bluetooth control led with lcd led status display real time.

Tthis project is going to show you how to make Bluetooth led control with lcd beside the Arduino sowing the new led status.

BeginnerFull instructions provided59,524
Bluetooth control led with lcd led status display real time.

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
RGB Backlight LCD - 16x2
Adafruit RGB Backlight LCD - 16x2
×1
Rotary potentiometer (generic)
Rotary potentiometer (generic)
×1
HC-05 Bluetooth Module
HC-05 Bluetooth Module
×1
LED (generic)
LED (generic)
×1
Smartphone or laptop
×1

Software apps and online services

Arduino IDE
Arduino IDE
SENA BTerm

Story

Read more

Schematics

bluetooth-setup2.png

untitled.png

Code

bluetooth_led.ino

C/C++
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int ledPin = 13; 
int state = 0;
int flag = 0; 
 
void setup() {
  pinMode(ledPin, OUTPUT);
 digitalWrite(ledPin, LOW);
  lcd.begin(16, 2);
 Serial.begin(9600); // Default connection rate for my BT module
lcd.setCursor(0, 1);
  lcd.print("By: Youssef Emad");
}

  
void loop() {

 if(Serial.available()){
 state = Serial.read();
 flag=0;
 }

 if (state == '0') {
 digitalWrite(ledPin, LOW);
 if(flag == 0){
 lcd.print("LED: off");
 delay(1000);
 lcd.clear();
 Serial.println("LED: off");
 flag = 1;
 }}
 else if (state == '1') {
 digitalWrite(ledPin, HIGH);
 if(flag == 0){
 lcd.print("LED: on");
  delay(1000);
 lcd.clear();
 Serial.println("LED: on");
 flag = 1;
 }}
}

 

Credits

Youssef Sabaa

Youssef Sabaa

5 projects • 53 followers

Comments