Sunday 15 June 2014

WEEK 21 - GAS PROGRAM

// ==============================
int readSensor(int PIN, int SAMPLES) {
  // The process of counting detector LPG sensors on analog port 0
  int avgValue;
  int val[SAMPLES];
  int runningTotal = 0;

  for(int x = 0; x < SAMPLES; x++){
    val[x] = analogRead(PIN);
    runningTotal = runningTotal + val[x];
    delay(interval/SAMPLES);
    }
    avgValue = runningTotal/SAMPLES;
  return avgValue;
}

// ==============================
void safe(){
  // Commands display the current conditions there is no leakage of LPG gas
  lcd.setCursor(6, 1);
  lcd.print("SAFE HOUSE");
  delay(500);
}

// ==============================
void danger(){
    // Display commands when there is a gas leak detection LPG
    lcd.setCursor(5, 1);
    lcd.print("DANGER");
    delay(500);
}

// ==============================

This program is for test the gas sensor.


No comments:

Post a Comment