0% found this document useful (0 votes)
5 views

Code For

This Arduino code controls two light bulbs using Bluetooth. It uses an LCD screen to display status messages and turns on/off the bulbs based on character inputs received over Bluetooth.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Code For

This Arduino code controls two light bulbs using Bluetooth. It uses an LCD screen to display status messages and turns on/off the bulbs based on character inputs received over Bluetooth.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

#include <LiquidCrystal.

h>
LiquidCrystal lcd(13, 12, 11, 10, 9, 8);
void setup() {

pinMode(3, OUTPUT);

pinMode(4, OUTPUT);

Serial.begin(9600);

lcd.begin(16, 2);
lcd.setCursor (0,0);
lcd.print("**Bluetooth**");
lcd.setCursor (0,1);
lcd.print("Control Project");
delay(10000);
lcd.clear();
//lcd.print("Bluetooth control project");

void loop() {

if (Serial.available() > 0)

char c = Serial.read();

if (c == 'a')

Serial.print("in a code");

digitalWrite(4,HIGH);

digitalWrite(3,LOW);

//Serial.print("4 HIGH");

lcd.clear();
lcd.setCursor (0,0);
lcd.print("**BULB1 OFF**");

}
if(c=='b')

digitalWrite(3,HIGH);

digitalWrite(4,LOW);

//Serial.print("3 HIGH");

lcd.clear();
lcd.setCursor (0,0);
lcd.print("**BULB2 OFF**");

if(c=='c')

digitalWrite(4,HIGH);

digitalWrite(3,HIGH);

lcd.clear();
lcd.setCursor (0,0);
lcd.print("**BULB 1,2 OFF**");

if(c=='d')

digitalWrite(4,LOW);

digitalWrite(3,LOW);

lcd.clear();
lcd.setCursor (0,0);
lcd.print("**BULB 1,2 ON**");

}
}

You might also like