 #include <Adafruit_Sensor.h>
 #include <Adafruit_BMP085.h>
 #include <aisa_BMP180.h>
+#include <aisa_ethernet.h>
 #include <string.h>
 
 byte mac[] = {0x90, 0xA2, 0xDA, 0x0E, 0xF6, 0x8E};
 
 IPAddress server(192,168,13,14);
 
-EthernetClient client;
+//EthernetClient client;
+
+aisa_ethernet * ethernet;
 
 aisa_BMP180 * bmp;
 

{
    Serial.begin(57600);


    Serial.println(F("configuring ethernet..."));
    if (Ethernet.begin(mac) == 0)
    {
        Serial.println(F("Failed to configure Ethernet using DHCP"));
        while(1){}
    }

    delay(1000);
    Serial.println(F("ethernet configured."));

    bmp = new aisa_BMP180(arduinoName);

}

void loop()
{
    takeBmp180Reading();

    delay(5000);
}


void takeBmp180Reading()
{
    char parameters[110];
    char request[260];

    float degreesCelcius = bmp->getDegreesCelcius();
    float hectoPascals = bmp->getHectoPascals();

    dtostrf(hectoPascals, 1, 2, hectoPascalsBuffer);
    dtostrf(altitudeInMeters, 1, 2, altitudeInMetersBuffer);

    int contentLength = sprintf(parameters,
        "{\"sensorName\": \"outside-deck\", \"degreesCelcius\": %s, \"hectoPascals\": %s, \"altitudeInMeters\": %s}",
        degreesCelciusBuffer,
        hectoPascalsBuffer,
        altitudeInMetersBuffer);

    if (ethernet->post(server, 1337, "/api/v1/arduino-home/bmp180", parameters))
    {
        Serial.println(F(" Created"));
    }
    else
    {
        Serial.println(F(" error"));
    }
}