// Potentiometer is connected to GPIO 34 (Analog ADC1_CH6)
const int potPin = 15;
// variable for storing the potentiometer value
int ADC = 0;
void setup() {
Serial.begin(115200);
delay(1000);
}
void loop() {
// Reading potentiometer value
ADC = analogRead(potPin);
Serial.print("Analog value: ");
Serial.print(ADC);
Serial.print(" volt: ");
Serial.print(ADC*3.3/4095);
Serial.print(" temp: ");
Serial.print((ADC*3.3/4095)/0.01);
Serial.println(" C ");
delay(100);
}
tugas :
led hijau on suhu <27
led kuning on suhu 27-29
led merah on suhu 30-32
led merah blink suhu >32