 void update(int type, int pin) {
   String c, v;
   switch (type) {
-    case 0:
-        c = "lm35_" + String(pin);
-        v = String(lm35(pin));
+    case BMP180T:
+        double T;
+        c = "BMP180T";
+        if (bmp180Temperature(T)) v = String(T);
+        else v = c + " Error";
         break;
-    case 1:
-        c = "ldr_" + String(pin);
-        v = String(ldr(pin));
+    case BMP180P:
+        double P;
+        c = "BMP180P";
+        if (bmp180Pressure(P)) v = String(P);
+        else v = c + " Error";
         break;
   }
   sendCommand(c, v);
 }
 
 void updateAll() {
-  for (int i = 0; i < numSen; i++) {
+  for (int i = 0; i < count(updateTimes); i++) {
     unsigned long actTime = millis();
     if (actTime - lastUpdate[i]  > updateTimes[i]) {
       update(types[i], pins[i]);

// 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};

int secureAnalogRead(int pin) {
  delay(0.01);

  String inp = readCommand();
  if (inp == "") {
  } else if (inp == "dump") {
    for (int i = 0; i < count(updateTimes); i++) {
      String com = String(i) + " " + String(types[i]) + " " + String(updateTimes[i]) + " " + String(pins[i]);
      sendCommand("dump_pin", com);
    }
