I want to connect my smartphone with Bluetooth. But I can’t connect.
My goal is to look at the text messages on the LCD on my smartphone.
The coding below is self make. Please help me with coding.
#include <LiquidCrystal.h>
#include <SoftwareSerial.h>
//
LiquidCrystal lcd(7,6,5,4,3,2);
SoftwareSerial hc06(11,10); // 11—블루투스TX // 10—블루투스RX
//
int smokeA0=A0;
int redLed=13,greenLed=12,buzzer=8;
//
int sensorThres=300;
//
void setup(){
pinMode(redLed,OUTPUT); pinMode(greenLed,OUTPUT);
lcd.begin(16,2);
Serial.begin(9600);
hc06.begin(9600);
}
//
void loop(){
if(hc06.available()){
Serial.write(hc06.read());
}
if(Serial.available()){
hc06.write(Serial.read());
}
//
int analogSensor=analogRead(smokeA0);
Serial.print("Pin A0: "); Serial.println(analogSensor);
lcd.setCursor(0,0); lcd.print("smoke Level: "); lcd.print(analogSensor-50);
if(analogSensor-50>sensorThres){
digitalWrite(redLed,HIGH); digitalWrite(12,LOW);
lcd.setCursor(0,1); lcd.print(“Alert…!!!”);
tone(buzzer,1000,200);
}
else{
digitalWrite(redLed,LOW); digitalWrite(12,HIGH);
lcd.setCursor(0,1); lcd.print("…Normal…");
noTone(buzzer);
}
delay(500);
lcd.clear();
}