const int pSuhu = A0;
float suhu, data;
void setup() {
analogReference(INTERNAL);
Serial.begin(9600);
pinMode(pSuhu, INPUT);
}
void loop() {
data = analogRead(pSuhu);
suhu = data * 110 / 1024;
Serial.print("data: ");
Serial.print(data);
Serial.print(", suhu: ");
Serial.print(suhu);
Serial.print(" C (");
Serial.print(convertToF(suhu));
Serial.print(" F)");
Serial.println();
delay(1000);
}
float convertToF(float suhuC){
return (suhuC * 9.0/5.0) + 32;
}