When the temperature threshold is reached, the digital interface will send a HIGH signal turning on the LED on the Arduino (pin 13). Turn the potentiometer clock-wise to increase the detection threshold and counter-clockwise to decrease it.
The analog interface returns a numeric value that depends on the temperature and the potentiometer's position. Since analog output pin is directly connected to the potentiometer it isn't possible to use the Steinhart-Hart equation to calculate the temperature as as we did with the KY-013, we can only use this value to measure relative changes in temperature.
int led = 13;int digitalPin = 2;int analogPin = A0;int digitalVal;int analogVal;
void setup()
{
pinMode(led, OUTPUT);
pinMode(digitalPin, INPUT);
Serial.begin(9600);
}
void loop()
{
digitalVal = digitalRead(digitalPin);
if(digitalVal == HIGH) {
digitalWrite(led, HIGH); }
else
{
digitalWrite(led, LOW); }
analogVal = analogRead(analogPin);
Serial.println(analogVal);
delay(100);
}