/***********************
ANALOG TEMPERATUS SENSOR
************************/
//TUGAS LKS 8 PELATIHAN DIDAMBA 15 P4TKIPA
//ISRAWATI IDRIS, S.Pd - SMA NEGERI 3 PARIAMAN

//Cara Kerja : NTC membaca suhu lingkungan dalam selang waktu tertentu

const float BETA = 3950;

void setup() {
 Serial.begin(9600);
}

void loop() {
 const float BETA = 3950; // should match the Beta Coefficient of the thermistor
 int analogValue = analogRead(A0);
 float celsius = 1 / (log(1 / (1023. / analogValue - 1)) / BETA + 1.0 / 298.15) - 273.15;
 Serial.print("Suhu :");
 Serial.print(celsius);
 Serial.print("  derajat celcius");
 Serial.println();
 delay(1000);
}