Reduce signal noise

'''
Hallo everyone,

its a code wich read the temperature with a thermistor . and by clicking a button turn relay on and off.

the problem with this code is i recieve Temprature with comma. for example (20.01 C°)
but i want this resault as (20 C°) and ingnore the comma .
can anyone help me ?

'''
#the code is

#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int ThermistorPin = A0;
int Vo;
float R1 = 100000;
float logR2, R2, T;
float c1 = 1.009249522e-03, c2 = 2.378405444e-04, c3 = 2.019202697e-07;
const int relay = 10;
const int button = 8;
int state = 0;
void setup()
{
pinMode(button, INPUT);
pinMode(relay, OUTPUT);
digitalWrite(relay, LOW);
Serial.begin(9600);
}
void loop(){
Vo = analogRead(ThermistorPin);
R2 = R1 * (1023.0 / (float)Vo - 1.0);
logR2 = log(R2);
T = (1.0 / (c1 + c2logR2 + c3logR2logR2logR2));
T = T - 273.15;
lcd.print("Temp:");
lcd.setCursor(6, 1);
lcd.print(T);
lcd.setCursor(0, 1);
delay(50);
state=digitalRead(button);
if (state==1 && T < 28)
{digitalWrite (relay, HIGH);}

else
{
digitalWrite(relay, LOW);
}
Serial.print("Temperature: ");
Serial.print(T);
Serial.println("c");
delay(50);
}

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use [color = red]code tags[/color] (the </> icon above the compose window) to make it easier to read and copy for examination

Your topic was MOVED to its current forum category as it is more suitable than the original

lcd.print(int(T)); ?????

Code tags, use them.

lcd.print(T); // Print Temperature on lcd

my problem is how can i change the calculation to a pt100 sensor,

i have this calculation and it calculate only resault of a thermistor. but i need to connect a pt100 Temperature sensore, i need only the calculation

I guess my earlier posting did not help. Have you tried to do a search on the words "arduino convert float to int"?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.