Skip to content

Instantly share code, notes, and snippets.

@ThaiEasyElec
Created July 23, 2019 10:33
Show Gist options
  • Save ThaiEasyElec/5d219364a24ff6db2f1bf0743dc722b7 to your computer and use it in GitHub Desktop.
Save ThaiEasyElec/5d219364a24ff6db2f1bf0743dc722b7 to your computer and use it in GitHub Desktop.
Home Alarm System
void motion_on() { // Function Open PIR Motion Sensor.
alarmValue = digitalRead(pir); // Read analog sensor 0 or 1.
//Serial.println (alarmValue); // Debug Sensor value.
if (alarmValue == 0) // Check the value
{
Alarm();
}
else
{
Alarm_off();
}
}
void flame_on(){ // Function Open Flame Detector Sensor.
alarmValue = analogRead(flame); // Read analog sensor 0-1023.
//Serial.println (alarmValue); // Debug Sensor value.
if(alarmValue <= 700){ // Check the value
Alarm();
}
if(alarmValue > 700){
Alarm_off();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment