function updateBMP180() {
  fetch('BMP180.json')
    .then(res => res.json())
    .then(data => {
      document.getElementById('temperature').textContent = `Temperature: ${data.temperature.toFixed(2)} °C`;
      document.getElementById('pressure').textContent = `Pressure: ${data.pressure.toFixed(2)} hPa`;
    })
    .catch(err => console.error("Error BMP180:", err));
}

function updateHTU21D() {
  fetch('HTU21D.json')
    .then(res => res.json())
    .then(data => {
      document.getElementById('humidity').textContent = `Humidity: ${data.humidity.toFixed(1)} %`;
      document.getElementById('tempHTU').textContent = `Temperature: ${data.temperature.toFixed(1)} °C`;
    })
    .catch(err => console.error("Error HTU21D:", err));
}

setInterval(() => {
  updateBMP180();
  updateHTU21D();
}, 3000);

// Carga inicial
updateBMP180();
updateHTU21D();
