User manual

Ausgabe 19.05.2017 Copyright by Joy-IT 36
int flame=0; // selects analog PIN 0 for sensor
int Beep=9; // selects digital PIN9 for buzzer
int val=0; // initialises variable
void setup()
{
pinMode(Beep,OUTPUT); // sets buzzer PIN to „output“
pinMode(flame,INPUT); // sets flame semsor PIN to „input“
Serial.begin(9600); // sets baudrate to „9600“
}
void loop()
{
val=analogRead(flame); // reads the sensors analog value
Serial.println(val); // prints the value
if(val>=600) // buzzer beeps if value over 600
{
digitalWrite(Beep,HIGH);
}else
{
digitalWrite(Beep,LOW);
}
delay(500);
}