 
 int status = WL_IDLE_STATUS;
 WiFiClient conn;
+std::vector<Pin> pins;
 
 void setup() {
   Serial.begin(9600);


  Serial.println("\nWifi initialized. Connecting to server.");
  printWifiStatus();
  while(!conn.connect(server, port)) {
    Serial.println("Can't connect to the server. Rebooting.");
    Serial.flush();
    softReset();
  }

  Serial.println("connected to server");
  Serial.flush();
}

void initWifi() {

  pseudopod = new Pseudopod(conn, conn);
}

int freeRam () 
{
  extern int __heap_start, *__brkval; 
  int v; 
  return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval); 
}

void loop() {
  connectToServer();
  Serial.println("writing");
  Serial.flush();
  pins.clear();
  for(int i = 0; i < 80; i++) {
    pins.push_back(Pin(i,NULL, i));
  }
  Serial.println("pushed a lot of pins into a vector");
  int written = pseudopod->writeStateMessage(pins);
  Serial.print(written);
  Serial.println(" bytes written.");
  Serial.print(freeMemory());
  Serial.print(" : ");
  Serial.print(freeRam());
  Serial.println(" bytes free");
  Serial.flush();
  delay(2000);
  conn.stop();  
}

void setupWifi() {
