/* Analog Read Send
blink a LED when significant difference between 2 thermistors
*/
int tempPin1 = 1; // select the input pin for the thermistor
int tempPin2 = 2;
int ledPin = 13; // select the pin for the LED
int temp1 = 0; // variable to store the value coming from the sensor
int temp2 = 0;
void setup() {
pinMode(ledPin, OUTPUT); // declare the ledPin as an OUTPUT
Serial.begin(9600); // use the serial port to send the values back to the computer
}
void loop() {
temp1 = analogRead(tempPin1);
temp2 = analogRead(tempPin2); // read the value from the sensor
Serial.print(“temp1:”);
Serial.println(temp1); // print the value to the serial port
Serial.print(“temp2:”);
Serial.println(temp2);
delay(200);
if (temp1 – temp2 > 50){
digitalWrite(ledPin, HIGH);
delay(200);
digitalWrite(ledPin, LOW);
Serial.println(“I’m blushing”);
}
else{
digitalWrite(ledPin, LOW);
}
}
Filed under: Computers for Rest of you, pcomp