You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
714 B
JavaScript

console.log("Hello World !!! ");
async function FetchData(){
try{
const tempResponse = await fetch('./HTU21D.json');
const tempData = await tempResponse.json();
document.getElementById('Temp-Value').textContent = tempData.Temperature.toFixed(1) + '°C';
const tempHumidity = await fetch('./HTU21D.json');
const tempHum = await tempHumidity.json();
document.getElementById('Hum-Value').textContent = tempHum.Humidity.toFixed(1) + '%';
const brightResponse = await fetch('./BH1750.json');
const brightData = await brightResponse.json();
document.getElementById('Bright-Value').textContent = brightData.Brightness.toFixed(1) + 'lux';
} catch (error){
console.log(error);
}
}
FetchData();