Hi,
I need some help please!
I want to control temperature sensor from bluetooth's phone. SO I want this:
If "1" call " detect_temperature() " , If "0" so "destroy detect_temperature()".
the monitor keep posting temperature and don't response. what is wrong?
void loop(){
if(mySerial.available() > 0){
state = mySerial.read();
if (state == '1') {
Serial.println("Smart Vigil enable");
Vigil = true;
}
if (state == '0') {
Serial.println("Smart Vigil disabled");
Vigil = false;
}
}
if (Vigil = true)
{
detect_temperature();
}else if (Vigil = false)
{ }
void detect_temperature(){
temp = analogRead(tempPin);
temp = temp * 0.48828125;
Serial.print("TEMPRATURE = ");
Serial.print(temp);
Serial.print("*C");
Serial.println();
delay(100);
}
}
I tried this too
if(mySerial.available() > 0){
state = mySerial.read();
}
if (state == '1') {
Serial.println("Smart Vigil enable");
Vigil = true;
}
if (state == '0') {
Serial.println("Smart Vigil disabled");
Vigil = false;
}
if (Vigil = true)
{
detect_temperature();
}else if (Vigil = false)
{ }
void detect_temperature(){
temp = analogRead(tempPin);
temp = temp * 0.48828125;
Serial.print("TEMPRATURE = ");
Serial.print(temp);
Serial.print("*C");
Serial.println();
delay(100);
}
thanks