Help With Air Quality Sensors

like this?: still doesnt work i deleted delays

  for (int i = 1; i <= 7; ++i) {
    duration1 = pulseIn(pin1, LOW);
    duration2 = pulseIn(pin2, LOW);
    lowpulseoccupancy1 = lowpulseoccupancy1+duration1;
    lowpulseoccupancy2 = lowpulseoccupancy2+duration2;
    if ((millis()-starttime) > sampletime_ms)//if the sampel time == 30s
    {
      ratio1 = lowpulseoccupancy1/(sampletime_ms*10.0);  // Integer percentage 0=>100
      concentration1 = 1.1*pow(ratio1,3)-3.8*pow(ratio1,2)+520*ratio1+0.62; // using spec sheet curve

      ratio2 = lowpulseoccupancy2/(sampletime_ms*10.0);  // Integer percentage 0=>100
      concentration2 = 1.1*pow(ratio2,3)-3.8*pow(ratio2,2)+520*ratio2+0.62; // 

      lowpulseoccupancy1 = 0;
      lowpulseoccupancy2 = 0;
      starttime = millis();
      lcd.clear();
      lcd.print("PM10: ");
      lcd.print(concentration1,3);
      lcd.setCursor(0,1);
      lcd.print("conc1 = ");
      lcd.print(concentration1);
      lcd.setCursor(0,2);
      lcd.print("conc2 = ");
      lcd.print(concentration2);
      }
  } 

can i send a video file ?? @b707

Your condition

will match only once during the for loop - so the values will update once.

Please understand - the only way to show 7 different values in this for loop - wait for
7 * sampletime_ms periods.

hello, so how to make it update 10 times in 10 second??
7 was just a random thing

and still i cant find a way to alternate delay()

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.