 const char* streamId   = "....................";
 const char* privateKey = "....................";
 
-float G[3]={0.0,0.0,0.0};
-float alpha=0.9;
+float G[3] = {0.0, 0.0, 0.0};
+float alpha = 0.9;
 
+long timer_read_from_accel = 0;
+long timer_send_data_wifi = 0;
 void setup() {
   Serial.begin(115200);
   delay(10);
 
 
- Serial.begin(9600);
-  Wire.begin(2,14);
-  accel.begin(BMA250_range_2g, BMA250_update_time_64ms);//This sets up the BMA250 accelerometer
-    USE_SERIAL.begin(115200);
-   // USE_SERIAL.setDebugOutput(true);
+  Serial.begin(9600);
+  Wire.begin(2, 14);
+  accel.begin(BMA250_range_2g, BMA250_update_time_4ms);//This sets up the BMA250 accelerometer
+  USE_SERIAL.begin(115200);
+  // USE_SERIAL.setDebugOutput(true);
 
-    USE_SERIAL.println();
-    USE_SERIAL.println();
-    USE_SERIAL.println();
+  //    USE_SERIAL.println();
+  //    USE_SERIAL.println();
+  //    USE_SERIAL.println();
 
-    for(uint8_t t = 4; t > 0; t--) {
-        USE_SERIAL.printf("[SETUP] WAIT %d...\n", t);
-        USE_SERIAL.flush();
-        delay(1000);
-    }
+  for (uint8_t t = 4; t > 0; t--) {
+    USE_SERIAL.printf("[SETUP] WAIT %d...\n", t);
+    USE_SERIAL.flush();
+    delay(1000);
+  }
 
   // We start by connecting to a WiFi network
 


#define USE_SERIAL Serial

const char* ssid     = "HackBulgaria";
const char* password = "";


  client.print("\r\n\r\n");
  client.print(tsData);
  client.print("Connection: close\r\n\r\n");

if (millis() - 200 >= timer_send_data_wifi) {
 timer_send_data_wifi = 0;
 
row = "";
  // Read all the lines of the reply from server and print them to Serial
  //  while(client.available()){
  //    String line = client.readStringUntil('\r');
  //    Serial.print(line);
  //  }

  //  Serial.println();
  //  Serial.println("closing connection");
  }
}

