TEMPERATURE SENSOR

MATERIALS
  • ArduinoUNO
  • Breadboard
  • Jumperwires
  • Arduino USB cable
  • 1 LED
  • 1 Resistor (220 Ohms)
  • 1 Temperature Depending Resistor
  • A computer with Arduino IDE
BREADBOARD ASSEMBLY



SCHEME







CODE

int AO = 0;
const int LED = 7;

void setup() {
  Serial.begin(9600);
  pinMode(LED,OUTPUT);
}

void loop(){
  int rawvoltage = analogRead(AO);
  float millivolts = (rawvoltage/1024.0) * 5000;
  float fahrenheit = millivolts/10;
  Serial.print(fahrenheit);
  Serial.println(" degrees Fahrenheit, ");
  if (fahrenheit >= 80)
  {
    digitalWrite(LED, HIGH);
    delay(500);
    digitalWrite(LED, LOW);
    delay(500);
  }
}

Comments

Popular Posts