   //only temperature (case 1) has a decimal place
   //if (sampleType == 1) prec = 1; else prec = 0;
   char tempChar[10];
-  dtostrf(number, 3, precision, tempChar);
+  dtostrf(number, 1, precision, tempChar);
   stringNumber += tempChar;
   return stringNumber;
 }

  else if (analogValue<221) uvi = 10;
  else if (analogValue<240) uvi = 11;
  return uvi;
}

//Method for posting a measurement to OSM server
void postObservation(String measurement, String sensorId, String boxId)
{  
  //if (measurement=="") return;
  wdt_enable(WDTO_8S);
  //json must look like {"value":"12.5"} 
  String valueJson = "{\"value\":"; 
  valueJson += measurement; 
  valueJson += "}";
  Serial.println(valueJson);
  //post observation to: http://opensensemap.org:8000/boxes/boxId/sensorId
  // if you get a connection, report back via serial: 
  wdt_reset();
  if (client.connect(server, 8000)) 
  {
    Serial.print("connected..."); 
    Serial.println();
    // Make a HTTP Post request: 
    client.print("POST /boxes/"); 
    client.print(boxId);
    client.print("/"); 
    client.print(sensorId); 
    client.println(" HTTP/1.1"); 
    // Send the required header parameters 
    client.println("Host:opensensemap.org"); 
    client.println("Content-Type: application/json"); 
    client.println("Connection: close");  
    client.print("Content-Length: "); 
    client.println(valueJson.length()); 
    client.println(); 
    client.print(valueJson); 
    client.println(); 
    Serial.println("done!");
    uploadSuccess = true;
    //Change case
    if (sampleType == 5) {
      sampleType = 1;
      // remember the time that the connection was made or attempted
      lastConnectionTime = millis();
    }else sampleType++;
  }else 
  {
    // stop the client if you couldn't make a connection !
    Serial.println("failed...disconnecting.");
    client.stop();
  }
  wdt_disable();
}

        currentSensorId = LUXSENSOR_ID;
        break;
      case 5:
        analogUvLight = analogRead(UVPIN);
        sensorSample = (String)calcUVIndex(analogUvLight);
        currentSensorId = UVSENSOR_ID;
        break;
    }
    Serial.println("done...................");
  }

  jsonData = "{\"value\":"; 
  jsonData += sensorSample; 
  jsonData += "}";
  Serial.println(jsonData);
  contLen = jsonData.length();
  Adafruit_CC3000_Client client = cc3000.connectTCP(ip, 8000);
  
  if (client.connected()) {
    /*
    clientclient.print(F("GET "));
    client.print(F("/"));
    client.print(F(" HTTP/1.1\r\n"));
    client.print(F("Host: ")); client.fastrprint(WEBSITE); .fastrprint(F("\r\n"));
    www.print(F("\r\n"));
    www.println();
    */
    client.print("POST /boxes/");
    client.print(SENSEBOX_ID);
    client.print("/"); 
    client.print(currentSensorId); 
    client.print(" HTTP/1.1\r\n"); 
    client.println("Host: opensensemap.org");
    client.println("Content-Type: application/json");   
    client.print("Content-Length: "); 
    client.println(contLen); 
    client.println("Connection: close");
    client.println(); 
    client.print(jsonData); 
    client.println(); 
    Serial.println("done!");
    uploadSuccess = true;
  } else {
    Serial.println(F("Connection failed"));    
    uploadSuccess = false;
    return;
  }

  Serial.println(F("-------------------------------------"));
  
  /* Read data until either the connection is closed, or the idle timeout is reached. */ 
  unsigned long lastRead = millis();
  while (client.connected() && (millis() - lastRead < IDLE_TIMEOUT_MS)) {
    while (client.available()) {
      char c = client.read();
      Serial.print(c);
      lastRead = millis();
    }
  }
  client.close();
  Serial.println(F("-------------------------------------"));
  if (uploadSuccess){
    if (sampleType == phenomenonCount) {
      sampleType = 1;
    }else sampleType++;
  }
  /* You need to make sure to clean up after yourself or the CC3000 can freak out */
  /* the next time your try to connect ... */
  Serial.println(F("\n\nDisconnecting"));
//  cc3000.disconnect();

 delay(1000);
}

String floatToString(float number, int precision)
