Keyestudio KS0436 Kit Manual page 157

Table of Contents

Advertisement

1) Connect the
Upload Code:
2) Open the program in the code folder- Circuit 13, or directly copy and
paste the code below on the Ardunio IDE.
3) Select UPLOAD to program the sketch on the UNO Board.
When it's approaching a fire, the voltage value read from the analog
port differs. If you use a multimeter, you can know when there is no fire
approaching, the voltage it reads is around 0.3V; when there is fire
approaching, the voltage it reads is around 1.0V.
The nearer the fire, the higher the voltage.
So in the beginning of the program, you can initialize voltage value i (no
fire value); Then, continuously read the analog voltage value j and
obtain difference value k=j-i; compare k with 0.6V (123 in binary) to
determine whether or not there is a fire approaching; if yes, the buzzer
will buzz.
int flame=0;// select analog pin 0 for the sensor
int Beep=9;// select digital pin 9 for the buzzer
int val=0;// initialize variable
REV4
Board to a USB port on your computer.
157

Advertisement

Table of Contents
loading

Table of Contents