Keyestudio KS0436 Kit Manual page 158

Table of Contents

Advertisement

void setup()
{
pinMode(Beep,OUTPUT);// set LED pin as "output"
pinMode(flame,INPUT);// set buzzer pin as "input"
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);
}
158

Advertisement

Table of Contents
loading

Table of Contents