Serial.begin(9600);// set baud rate at "9600"
}
void loop()
{
val=analogRead(flame);// read the analog value of the sensor
Serial.println(val);// output and display the analog value
if(val>=600)// when the analog value is larger than 600, the buzzer will buzz
{
digitalWrite(Beep,HIGH);
}else
{
digitalWrite(Beep,LOW);
}
delay(500);
}
//////////////////////////////////////////////////////////
Result
This program can simulate an alarm when there is a fire. Everything is normal when there is no
fire; when there is, the alarm will be set off immediately.
*******************************************************************************
Project 14: Analog temperature (thermistor)
Introduction
Thermistor is a temperature measuring component base on the principle that a conductor changes
in resistance with a change in its body temperature. As a result, it requires the temperature
coefficient and the resistivity of the conductor to be as large and stable as possible. It is best that
the resistance is in linear relationship with temperature. And it should also have stable physical
and chemical properties in a wide range. Currently, the most used thermal resistance materials are
platinum, nickel and copper.
Hardware required
Thermistor *1
10KΩ resistor *1
Breadboard *1
Breadboard jumper wires * several
Schematic diagram
keyestudio
www.keyestudio.cc
62
Need help?
Do you have a question about the ARDUINO maker learning kit and is the answer not in the manual?