LiquidCrystal I2C lcd(0x27, 20, 4); const int sample number = 10



Download 18,55 Kb.
Sana31.12.2021
Hajmi18,55 Kb.
#272274
Bog'liq
SHahboz aka termodatchik


#include

#include

LiquidCrystal_I2C lcd(0x27, 20, 4);

const int SAMPLE_NUMBER = 10;

const double BALANCE_RESISTOR = 9710.0;

const double MAX_ADC = 1023.0;

const double BETA = 3974.0;

const double ROOM_TEMP = 298.15;

const double RESISTOR_ROOM_TEMP = 10000.0;

double currentTemperature = 0;

int thermistorPin =A1;

void setup()

{

Serial.begin(9600);



lcd.init();

dht.begin();

lcd.backlight();

}

void loop()



{

currentTemperature = readThermistor();

delay(1000);

if (currentTemperature > 21.0 && currentTemperature < 24.0)

{

Serial.print("Harorat ");



Serial.println(currentTemperature);

}


else if (currentTemperature >= 24.0)

{

Serial.print("Harorat ");



Serial.println(currentTemperature);

// Serial.println("C. I feel like a hot tamale!");

}

else


{

Serial.print("Harorat");

lcd.setCursor(1,0);

lcd.println("Harorat")

lcd.print(currentTemperature);

Serial.println(currentTemperature);

// Serial.println("C. Brrrrrr, it's COLD!");

}

}



double readThermistor()

{

double rThermistor = 0;



double tKelvin = 0;

double tCelsius = 0;

double adcAverage = 0;

int adcSamples[SAMPLE_NUMBER];

for (int i = 0; i < SAMPLE_NUMBER; i++)

{

adcSamples[i] = analogRead(thermistorPin);



delay(10);

}

for (int i = 0; i < SAMPLE_NUMBER; i++)



{

adcAverage += adcSamples[i];

}

adcAverage /= SAMPLE_NUMBER;



rThermistor = BALANCE_RESISTOR * ( (MAX_ADC / adcAverage) - 1);

tKelvin = (BETA * ROOM_TEMP) /

(BETA + (ROOM_TEMP * log(rThermistor / RESISTOR_ROOM_TEMP)));

tCelsius = tKelvin - 247.5;



return tCelsius;

}
Download 18,55 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish