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

Author: Jan Wirwahn
Note: Sketch for SB-Photonik-WiFi
*/
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_CC3000.h>
#include <DHT.h>
#include <Barometer.h>
#include <Digital_Light_TSL2561.h>
//#include <avr/wdt.h>

//SenseBox ID

//Sensor IDs

// WLAN parameters
#define WLAN_SSID       "WiFi_Name"           // cannot be longer than 32 characters!
#define WLAN_PASS       "WiFi_Password"
// Security can be WLAN_SEC_UNSEC, WLAN_SEC_WEP, WLAN_SEC_WPA or WLAN_SEC_WPA2
#define WLAN_SECURITY   WLAN_SEC_WPA2  

// These are the interrupt and control pins
#define ADAFRUIT_CC3000_IRQ   3  
#define ADAFRUIT_CC3000_VBAT  5
#define ADAFRUIT_CC3000_CS    10
#define IDLE_TIMEOUT_MS  3000  
// Use hardware SPI for the remaining pins
// On an UNO, SCK = 13, MISO = 12, and MOSI = 11
Adafruit_CC3000 cc3000 = Adafruit_CC3000(ADAFRUIT_CC3000_CS, ADAFRUIT_CC3000_IRQ, ADAFRUIT_CC3000_VBAT,
                                         SPI_CLOCK_DIVIDER); // you can change this clock speed  
//Server values
#define WEBSITE "www.opensensemap.org"
uint32_t ip = 2159055603;

//Sensor pin settings
#define UVPIN A0
#define DHTPIN A1
#define DHTTYPE DHT11

String currentSensorId = TEMPERATURESENSOR_ID;
float temperature, humidity, pressure;
unsigned long lux;
int analogUvLight,contLen;

short phenomenonCount = 5; //1=temp,2=humi,3=pressure,4=lux,5=UV
int sampleType = 1; //begin with temperature
boolean uploadSuccess = true;
String sensorSample,jsonData;

DHT dht(DHTPIN, DHTTYPE);
Barometer barometer;

void setup(void)
{
  Serial.begin(115200);
  Serial.println(F("\nInitializing WiFi..."));
  if (!cc3000.begin())
  {
    Serial.println(F("failed! Check your wiring?"));
    while(1);
  }
  
  Serial.print(F("\nAttempting to connect to ")); Serial.println(WLAN_SSID);
  if (!cc3000.connectToAP(WLAN_SSID, WLAN_PASS, WLAN_SECURITY)) {
    Serial.println(F("Failed!"));
    while(1);
  }
   
  Serial.println(F("Connected!"));
  
  /* Wait for DHCP to complete */
  Serial.println(F("Requesting DHCP"));
  while (!cc3000.checkDHCP())
  {
    delay(100); // ToDo: Insert a DHCP timeout!
  }
  ip = 0;
  // Try looking up the website's IP address
  Serial.print(WEBSITE); Serial.print(F(" -> "));
  while (ip == 0) {
    if (! cc3000.getHostByName(WEBSITE, &ip)) {
      Serial.println(F("Couldn't resolve!"));
    }
    delay(500);
  }
  cc3000.printIPdotsRev(ip);  
  Serial.println("\nSTARTING UP");
  barometer.init();
  dht.begin();
  TSL2561.init();
}

void loop(void)
{
  if (uploadSuccess){
    Serial.print("Reading sensor...");
    sensorSample = "";
    switch (sampleType)
    {
      case 1:
        temperature = dht.readTemperature();
        //temperature = barometer.bmp085GetTemperature(barometer.bmp085ReadUT());
        sensorSample = floatToString(temperature,0);
        currentSensorId = TEMPERATURESENSOR_ID;
        break;
