 
   // **************** FOR GROVE SENSOR ****************
   ratio = lowpulseoccupancy / (grove_sample_time*10.0);  // Integer percentage 0=>100
+  // using spec sheet curve
   concentration = 1.1*pow(ratio, 3) - 3.8*pow(ratio, 2) + 520 * ratio + 0.62;
-  // using spec sheet curve
   lowpulseoccupancy = 0;  // reset
 
 
   // **************** FOR MQ7 SENSOR ****************
-  if (heaterInHighPhase) { 
-    if (millis() > CO_switch_time) {  // switch to 1.4V phase?
-      digitalWrite(CO_PWR_SEL_PIN, HIGH); // 1.4v phase
-      heaterInHighPhase = false;
-      CO_switch_time = millis() + CO_READ_TIME;
-    }
-  } else if (millis() > CO_switch_time) { // switch to 5V phase?
-      digitalWrite(CO_PWR_SEL_PIN, LOW);// 5v phase
-      heaterInHighPhase = true;
-      CO_switch_time = millis() + CO_HEAT_TIME;
+  
+    if (millis() > CO_switch_time) {  // switch to 1.4V phase
+      if (heaterInHighPhase) { 
+        digitalWrite(CO_PWR_SEL_PIN, HIGH); // 1.4v phase
+        heaterInHighPhase = false;
+        CO_switch_time = millis() + CO_READ_TIME;
+      } else { // switch to 5V phase
+        digitalWrite(CO_PWR_SEL_PIN, LOW);// 5v phase
+        heaterInHighPhase = true;
+        CO_switch_time = millis() + CO_HEAT_TIME;
+      }
   }
   // readGasLevel
   gasLevel = analogRead(CO_READ_PIN);
-  if (heaterInHighPhase)
-    gasLevel = 0xFFFF;
+ // if (heaterInHighPhase)
+ //   gasLevel = 0xFFFF;
 
   
   // **************** FOR TEMP & HUMIDITY SENSOR ****************
   // Reading can take 200 milliseconds, can only be done every 2 seconds
   float h = dht.readHumidity();
-  float f = dht.readTemperature(true);
+  float f = dht.readTemperature(false); // change to true for Farenheit
   if (isnan(h) || isnan(f)) { // Check if any reads failed and set to error value.
     h=255;    f=255;
   }

      
      if(!haveClock) { // set clock
        gps.crack_datetime(&gps_year, &gps_month, &gps_day, &gps_hour, &gps_minute, &gps_second);
         gps_hour -= 7; // adjust UTC FIXME!
         if (gps_hour < 0) {
           gps_day -=1;
           gps_hour +=24;
         }
         // rtc wants the year to be since 1900?
         rtc.adjust( DateTime(gps_year-2000, gps_month, gps_day, gps_hour, gps_minute, gps_second));
         haveClock=true;
      }

#endif

  // gps
  myFile.print(flat,6); myFile.print('\t');
  myFile.print(flon,6); myFile.print('\t');
  // altitude, speed?
  
  // date and time
  myFile.print(String(now.month()).length()==1 ? String('0') + String(now.month()) : now.month() );
  myFile.print('/');
  myFile.print(String(now.day()).length()==1 ? String('0') + String(now.day()) : now.day() );
  myFile.print('/');
  myFile.print(now.year());
  myFile.print(' ');
  myFile.print(String(now.hour()).length()==1 ? String('0') + String(now.hour()) : now.hour() );
  myFile.print(':');
  myFile.print(String(now.minute()).length()==1 ? String('0') + String(now.minute()) : now.minute() );
  myFile.print(':');
  myFile.print(String(now.second()).length()==1 ? String('0') + String(now.second()) : now.second() );
  myFile.print('\t');
  
  // sharp sensor value
  myFile.print(sharp_dust_val); myFile.print('\t');

  //  grove sensor value
  myFile.print(concentration);  myFile.print('\t');

  // MQ7 CO sensor value
  myFile.print(gasLevel);
  if(heaterInHighPhase)
    myFile.print(" (H)");
  myFile.print('\t');
  
  
  // DHT22 sensor value
  myFile.print(h);  myFile.print('\t');
