     + "Content-Length: " + payload.length() + "\r\n"
     + "\r\n"
     + payload + "\r\n";
-  http_post(request, payload);
+  http_post(request);
  }
  
  void lg_sensor(int val) {

void serial_setup(void) {
  SerialUSB.begin(115200); //Opens USB-Serial connection for terminal
  delay(5000);
  SerialUSB.print("Serial interface is ready\r\n");
}

void wifi_setup(void) {
  wifi.on(115200);
  if (wifi.wait(15000)) {
    SerialUSB.println("WIFI module started.");
  } else {
    SerialUSB.println("could not start WIFI.");
  }
  delay(2000),
  SerialUSB.println(wifi.info());
  delay(5000);

  wifi.setMode(0);
  
  while (! wifi.join(WIFI_SSID, WIFI_PASSWORD)) {
    SerialUSB.println('connecting to WIFI...');
    delay(5000);
  }
  SerialUSB.print("connected to WIFI. IP: ");
  SerialUSB.println(wifi.getip());
  SerialUSB.print("IP from my own getip(): ");
  SerialUSB.println(getIP(true)); // short version of IP, cached
  SerialUSB.print("MAC from my own gethostname(): ");
  SerialUSB.println(gethostname(true)); // short version of hostname, cached
  
}

void sensor_setup(void) {
  pinMode(powerPin, OUTPUT);  // Sensor Power
  pinMode(ledPin, OUTPUT);  // LED when measuring
  SerialUSB.println("sensor_setup(): done"); 
}
  


void loop() {
  SerialUSB.print("loop():  loops (minutes) since restart: ");
  SerialUSB.println(loopcnt);
    
  loopcnt++;
  if ((loopcnt % 1) == 0) lg_heartbeat(); // every 1 loops
  if ((loopcnt % 5) == 0) lg_sensor(soil_measure());    // every 5 minutes
  blinkLed(200);

  delay(60000); // one loop per minute 
}

String getIP(bool cache) {
  static String ip = "";
