 
   return average;
 }
+

  len += sprintf(https_url+len, "&chip_id=%d", chip_id);
  len += sprintf(https_url+len, "&build_time=%s", build_time.c_str());
  len += sprintf(https_url+len, "&reset_time=%d", reset_time);

  https.connect(logging_host, 443);
  https.print(String("GET ") + https_url + " HTTP/1.1\r\n" +

#endif
}

unsigned int sample_ambient_light()
{
  unsigned int ambient_light;
  
  digitalWrite(LIGHT_ENABLE, HIGH);
  digitalWrite(MUX, LOW);
  delay(10);
  ambient_light = analogSample();
  digitalWrite(LIGHT_ENABLE, LOW);

  return ambient_light;
}


unsigned int sample_soil_moisture()
{
  unsigned int soil_moisture;
  
  digitalWrite(SOIL_ENABLE, HIGH);
  digitalWrite(MUX, HIGH);
  delay(10);
  soil_moisture = analogSample();
  digitalWrite(SOIL_ENABLE, LOW);

  return soil_moisture;
}


void loop() {
  digitalWrite(LED_BUILTIN, LOW);

  ambient_light = sample_ambient_light();

  soil_moisture = sample_soil_moisture();
  
  // read humidity and temperature
  humidity = humiditySample();
  dtostrf(humidity, 5, 2, humidity_cstr);
