Thanks for your reply. All sketches works fine seperately. I found the problem ,the problem is it is getting the value one by for every loop what can i do to check it within a function
#include <SoftwareSerial.h>
SoftwareSerial btSerial(3, 4); // RX, TX
int chk, length, brLevel, photoCellValue, count = 0;
float hum, temp;
String msg;
boolean autoBR = true;
boolean messageCompleted = false;
boolean newMessage = false;
char incomingByte;
String command;
String tickerText;
void setup() {
Serial.begin(9600);
btSerial.begin(9600);
}
void loop() {
communication();
delay(500);
}
void communication() {
if (btSerial.available() > 0) {
incomingByte = btSerial.read();
if (incomingByte == '>') {
messageCompleted = true;
newMessage = false;
}
else if (incomingByte == '<') {
newMessage = true;
}
if (newMessage) {
command.concat(incomingByte);
}
}
if (messageCompleted) {
//Brightness level
if (command.charAt(1) == 'B') {
if (command.substring(2) == "Auto") {
Serial.println(command);
autoBR = true;
}
else {
autoBR = false;
brLevel = (command.substring(2)).toInt() - 1;
Serial.println(command);
}
}
//Update clock
else if (command.charAt(1) == 'T') {
int h = (command.substring(2, 4)).toInt();
int m = (command.substring(5, 7)).toInt();
int s = (command.substring(8, 10)).toInt();
int D = (command.substring(11, 13)).toInt();
int M = (command.substring(14, 16)).toInt();
int Y = (command.substring(17, 21)).toInt();
Serial.println(h);
Serial.println(m);
Serial.println(s);
Serial.println(D);
Serial.println(M);
Serial.println(Y);
}
//Update ticker text
else if (command.charAt(1) == 't') {
tickerText = command.substring(2);
Serial.println(tickerText);
}
command = "";
messageCompleted = false;
}
}