   //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;
 }

Author: Jan Wirwahn
Note: Sketch for SB-Photonik-WiFi
*/

#include <Wire.h>
#include <SPI.h>
#include <EthernetV2_0.h>
#include <DHT.h>
#include <Barometer.h>
#include <Digital_Light_TSL2561.h>
#include <avr/wdt.h>

//SenseBox ID

//Sensor IDs

//Sensor pin settings
#define UVPIN A0
#define DHTPIN A1
#define DHTTYPE DHT11
//Ethernet shield settings
#define W5200_CS 10
#define SDCARD_CS 4

//Network settings
IPAddress ip(192,168,178,111);//If DHCP is disabled, specify an IP according to your network settings
byte mac[] = { 0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02 };
char server[] = "opensensemap.org";
EthernetClient client;

String currentSensorId = TEMPERATURESENSOR_ID;
float temperature;
float humidity;
float pressure;

DHT dht(DHTPIN, DHTTYPE);
Barometer barometer;

//Variables for time sync and upload intervall
const unsigned long postingInterval = 10*1000*60; //1 minute
unsigned long lastConnectionTime = 0;
boolean lastConnected = false;
boolean uploadSuccess = true;
String sensorSample;
int sampleType = 1; //1=temp,2=humi,3=pressure,4=lux,5=UV

void setup(){
  Wire.begin();
  Serial.begin(9600);
  //Setup chip select and deselect the SD card
  pinMode(SDCARD_CS,OUTPUT);
  digitalWrite(SDCARD_CS,HIGH);
  delay(500);
  // start the Ethernet connection 
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP.");
    //If DHCP is disabled, use static IP
    Ethernet.begin(mac, ip);
  }else Serial.println("DHCP setup successful.");
  //Print the IP to serial port
  Serial.print("My IP address: ");
  for (byte thisByte = 0; thisByte < 4; thisByte++) {
    // print the value of each byte of the IP address:
    Serial.print(Ethernet.localIP()[thisByte], DEC);
    Serial.print("."); 
  }
  Serial.println("STARTING UP");
  barometer.init();
  dht.begin();
  TSL2561.init();
}

void loop(){
  // if there's incoming data from the net connection.
  // send it out the serial port.  This is for debugging purposes only
  if (client.available()) {
    char c = client.read();
    Serial.print(c);
  }
  // if there's no net connection, but there was one last time
  // through the loop, then stop the client:
  if (!client.connected() && lastConnected) {
    Serial.println();
    Serial.println();
    Serial.println("...stopping client!");
    client.stop();
  }  
  //If last upload was successful, switch case to select the next sensor
  if (uploadSuccess){
    Serial.println();
    delay(1000);
    sensorSample = "";
    switch (sampleType)
    {
      case 1:
        //temperature = dht.readTemperature();
        temperature = barometer.bmp085GetTemperature(barometer.bmp085ReadUT());
        sensorSample = floatToString(temperature,0);
        currentSensorId = TEMPERATURESENSOR_ID;
        break;

        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)
