Hi, im building a temperature control with the sensor PT1000 and arduino UNO and i get the temperature via bluetooth(HC-05)i control the temperature with a relay that is attached to 220v and a lamp. But my control is pretty simple doing it manual introducing the celcius i wanted on program. i just want to change that little point i want introduce the 50ºC(example) via serial monitor or bluetooth. I can do dat by defining TX for pin10 and connect that to Rx of bluetooth. Than i just say int ANDROIDtemp=10; and on the void loop() i have ANDROIDtemp=Serial.read(); but because i have a relay of 1s it just saves the 50ºC for 1s not forever.
I Hope i make me undestand
Regards,
Paul
#include <LiquidCrystal.h>
float temp;
int tempPin = A0;
int ANDROID=13;
byte pinoRele=8;
int ANDROIDtemp=10;
boolean toggle=true;
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
//Serial.begin(9600);
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
pinMode(pinoRele, OUTPUT);
digitalWrite(pinoRele,LOW);
Serial.begin(9600);
}
void loop() {
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 0);
// print the number of seconds since reset:
temp = analogRead(tempPin);
temp = ((temp *100)/1024);
delay(1000);
Serial.available();
Serial.read();
Serial.println("Temperatura:");
Serial.println(temp);
Serial.println(" C");
digitalWrite(ANDROID,toggle);
//toggle=!toggle;
lcd.print("Temperatura:");
lcd.setCursor(0,1);
lcd.print(temp);
lcd.print(" C");
ANDROIDtemp=Serial.read();
if(temp>(ANDROIDtemp+1)){
digitalWrite(pinoRele,LOW);
Serial.println("Luz Desligada");
}
else if(temp<(ANDROIDtemp-1)){
digitalWrite(pinoRele,HIGH);
Serial.println("Luz Ligada");
}
delay(1000);
//lcd.print(millis()/1000);
}