 // temps entre actualitzacions de els elements
 // [lm35_1, lm35_2, ldr_1]
-const int numSen = 3;
-const int groundPin = A0;
-int types[] = {0,0,1};
-unsigned long lastUpdate[] = {0,0,0};
-unsigned long updateTimes[] = {60000,60000,30000};
-int pins[] = {A1,A5,A3};
+#include <Wire.h>
+#include <SFE_BMP180.h>
+
+#define count(x) sizeof(x)/sizeof(unsigned long)
+#define groundPin A0
+#define ALTITUDE 570
+
+#define BMP180T 0   // Temperature
+#define BMP180P 1   // Pressure
+
+#define NOTUSED -1  // For BMP180 sensor.
+
+SFE_BMP180 pressure;
+
+int types[] = {BMP180T,BMP180P};
+unsigned long lastUpdate[] = {0,0};
+unsigned long updateTimes[] = {30000,60000};
+int pins[] = {NOTUSED,NOTUSED};
 
 int secureAnalogRead(int pin) {
   delay(0.01);

}

void setup() {
  Serial.begin(57600); // set the baud rate
  for (int i = 0; i < numSen; i++) {
    pinMode(pins[i], INPUT);
    update(types[i],pins[i]);
  }  
}

void loop() {

  delay(0.01);
  return analogRead(pin);
  
}

boolean bmp180Temperature(double &T) {
  char status;
  status = pressure.startTemperature();
  if (status != 0) {
    delay(status);
    status = pressure.getTemperature(T);
    if(status != 0) return true;
  }
  return false;
}

boolean bmp180Pressure(double &P) {
  double T, absP;
  char status;
  if(bmp180Temperature(T)) {
    Serial.println(T);
    delay(500);
    status = pressure.startPressure(3);
    if (status != 0) {
        delay(status);
        status = pressure.getPressure(absP,T);
        if (status != 0) {
          P = pressure.sealevel(absP,ALTITUDE);
          return true;
        }
      }
  }
  return false;
}

float lm35(int pin) {
