Project temperature. no accurate with bylnk temperature display

hi all
i have a problem as my project temperature no accurate with blynk temperature display.(project temperature show 36 deg c but blynk show 30 deg C) is that my code no correct or need to improve?

int sens1; //sensor define
int swA = 12 ;  //button input
int val;            //val definitation
int tempPin =A0;    //pin config
int sensorValue1 ;       //initial gas sensor value
#include <Servo.h>
Servo myservo;

#define BLYNK_PRINT Serial //blynk print serial data

#include <ESP8266WiFi.h>  //define ESP
#include <BlynkSimpleEsp8266.h> //define Blynk

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
 
char auth[] =
//char auth[] =
// Your WiFi credentials.
// Set password to "" for open networks.
const char* ssid = "esp";
const char* pass = "esp888";

// Variable to store the previous state for Button 0.
char previousButton0 = 0;
Servo servo;

BLYNK_WRITE(V3)
{
  servo.write(param.asInt());
}
 

void setup()
{
 
  // Set the  pin as output.
  pinMode(2, OUTPUT); // Set the  pin as output.
 
  Serial.begin(115200); //baudrate
  Blynk.begin(auth, ssid, pass); //begin system Blynk
  Blynk.virtualWrite(1,0); //set blynk virtual write
  Blynk.virtualWrite(2,0); //set blynk virtual write
  servo.attach(D4);
  digitalWrite(2, HIGH);  //off
}




void loop()
{
  Blynk.run(); //runt he program
  Blynk.virtualWrite(1,1023);  //LED Blink High
  delay(300);
  Blynk.virtualWrite(1, 0);  //LED Blink Low
  delay(300);

val = analogRead(tempPin);  //read temperature analog signal
float mv = ( val/1024.0)*5000;  //lm35 calculation
float cel = (mv/10)-20  ;              //lm35 calculation
float farh = (cel*9)/5 + 32;    //celcius calculation

Blynk.virtualWrite(2,cel);  //LED Blink High

Serial.print("TEMPRATURE = ");  //print temp char in serial
Serial.print(cel);             //print temp value in serial
Serial.print("*C");            //print char c in serial
Serial.println();              //print new line
delay(100);




}

@kelvin_007 please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```

Pete.

@PeteKnight, there is number of posts like your above one. I realize it must be kind of frustrating to keep telling people to use forums properly. In my forums I automated this, I detect any code by few simple tricks, multiple semicolon, brackets etc etc and do not let people post if it is not properly wrapped. I suggest you to do the same in this forums. I already started getting gray because of it :smiley:

P.S. is it totally custom board?

The forum runs on Discourse, but I’m just a moderator so it’s not my call.

Pete.

You could try Googling for a better formula format, I think yours is out of computational order??.. The order is divide by 5, then multiply by 9, then add 32. And you may have to use 0.5 and 0.9 otherwise they get treated as integers?.

And I have seen this site explain it with a different formula method.

Also, you shouldn’t be running all that code directly in your void loop() anyhow… read the help pages and use timers,

And finally… forum code formatting needs backticks, not commas or whatever you used :wink: FYI, I fixed it.

Blynk - FTFC

thank you!