The temperature sensor bricks uses a thermistor which returns the ambient temperature in the form of a resistance value. The 3 pins are GROUND, Vcc (5VDC), and SIGNAL. The onboard switch allow the sensor to be used in one of the ANALOG or DIGITAL modes. In ANALOG mode the SIGNAL can be read from an Arduino analog input. in DIGITAL mode the potentiometer adjusts the set point. If the temperature exceeds the set point the SIGNAL level goes HIGH.
Analog Mode (A)
Push the snap switch of sensor to analog output, connect S port to A0 port of Arduino board, and we will use the following program to read the analog value of temperature and send it to computer for display via the serial port.
int ASignal = A0; void setup() { Serial.begin(9600); } void loop() { int sensorValue = analogRead(ASignal); Serial.println(sensorValue);
}
Digital Mode (D)
Push the snap switch of sensor to digital output, connect S port to D2 port of Arduino board, and we will use the following program to read the digital value of temperature and send the threshold condition to computer for display.
int DSIGNAL = D2; void setup() { Serial.begin(9600); pinMode(DSIGNAL, INPUT); } void loop(){ int DsignalState = digitalRead(DSIGNAL); Serial.println(DsignalState); delay(100); }
Documentation