Heater control

hi everybody. i want to control my heater.İ have bluetooth module,relay module and ds18b20.

  float temperature = getTemp();
  float tempF = (temperature);
  Serial.println(tempF);
 delay(2000); //Checking new value
 if(Serial.available()) //bluetooth connection
  {
  int data = Serial.read();
  delay(100);
  // i send the data from my phone. for ex: temp = 25 i send 20, relay off . i want to control my heater... 
  if ( tempF <= data ) 
digitalWrite(RELAY1,HIGH); 
else if (tempF >= data)
digitalWrite(RELAY1,LOW); 
delay(1000);
}

ths is true ? code is true but i try on the breadboard not working.

full code:

#include <OneWire.h>
 int DS18S20_Pin = 2; //DS18S20 Signal pin on digital 2
int RELAY1 =3;
OneWire ds(DS18S20_Pin);  // on digital pin 2
 
void setup(void) {
  Serial.begin(9600);
}
 
void loop(void) {
  float temperature = getTemp();
  float tempF = (temperature);
  Serial.println(tempF);
 delay(2000); //Checking new value
 if(Serial.available()) //bluetooth connection
  {
  int data = Serial.read();
  delay(100);
  // i send the data from my phone. for ex: temp = 25 i send 20, relay off . i want to control my heater... 
  if ( tempF <= data ) 
digitalWrite(RELAY1,HIGH); 
else if (tempF >= data)
digitalWrite(RELAY1,LOW); 
delay(1000);
}

 
 
float getTemp(){
  //returns the temperature from one DS18S20 in DEG Celsius
 
  byte data[12];
  byte addr[8];
 
  if ( !ds.search(addr)) {
      //no more sensors on chain, reset search
      ds.reset_search();
      return -1000;
  }
 
  if ( OneWire::crc8( addr, 7) != addr[7]) {
      Serial.println("CRC is not valid!");
      return -1000;
  }
 
  if ( addr[0] != 0x10 && addr[0] != 0x28) {
      Serial.print("Device is not recognized");
      return -1000;
  }
 
  ds.reset();
  ds.select(addr);
  ds.write(0x44,1); // start conversion, with parasite power on at the end
 
  byte present = ds.reset();
  ds.select(addr);    
  ds.write(0xBE); // Read Scratchpad
 
 
  for (int i = 0; i < 9; i++) { // we need 9 bytes
    data[i] = ds.read();
  }
 
  ds.reset_search();
 
  byte MSB = data[1];
  byte LSB = data[0];
 
  float tempRead = ((MSB << 8) | LSB); //using two's compliment
  float TemperatureSum = tempRead / 16;
 
  return TemperatureSum;
 
}

my app pic:
my board pic :

"not working" is not a sufficient description of the problem. What does it actually do? What did you want it to do?

I suspect that code doesn't even compile. Look at the Arduino basic tutorials to find out what { and } actually mean.

if(Serial.available())
{
int data = Serial.read();
delay(100);
if ( data <= 'getTempCByIndex' )
{digitalWrite(RELAY1,LOW); }
else if ( data >= 'getTempCByIndex')
{digitalWrite(RELAY1,HIGH); }
}

these is my bluetooth codes. my sensor measure tempreature 22 Degress. i am sending by bluetooth 25 degress("data"). according to code my relay be HIGH (data(25) > gettempcbyındex(22) ). i am trying on the board but doesnt work.

What exactly is bluetooth sending? Is it sending the characters '2' and '5' or is it sending binary data?

Your code is reading the serial data as if it is binary. This will limit you to 0...255 or maybe -128...+127 The binary code of 25 is an unprintable control character.

Get your Arduino to print out the data received to a serial monitor so that you can check that it was received correctly. To do this, you may need to move the bluetooth module to a SoftwareSerial connection instead of the main serial connection.

i understand you. i am trying other sensors. for this ex i've tried softwareserial. but doesnt work.
'veri' meaning = volue

#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11);
#define RELAY1 3
const int analogInPin = A0;

int veri = 0;
void setup() {
Serial.begin(9600);
mySerial.begin(9600);
pinMode(RELAY1,OUTPUT);

}
void loop() {
veri = analogRead(analogInPin);

Serial.print("veri = " );
Serial.println(veri);
delay(750);

if(mySerial.available())
{
int data = mySerial.read();
delay(100);
if (data<='veri')

digitalWrite(RELAY1,LOW);
delay(1000);
if (data>'veri')

digitalWrite(RELAY1,HIGH);
delay(1000);
}
}

Ok, so what was the value of data when you printed it?

You probably also want to think about having data defined outside the if statement, that way incoming serial data will only update the variable and you don't need to wait for serial input before each time you switch the heater on or off.