34 lines
953 B
HTML
34 lines
953 B
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
<title>Pico Webserver</title>
|
|
<style>
|
|
body { font-family: sans-serif; background: #f0f0f0; text-align:center; margin-top: 50px; }
|
|
#data { font-size: 1.5rem; white-space: pre-line; }
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<h1>Temperaturüberwachung</h1>
|
|
<div id="data">Temperatur: 24.2°C<br>Luftfeuchtigkeit:42.2%</div>
|
|
|
|
<script>
|
|
/*async function fetchSensorData() {
|
|
try {
|
|
const res = await fetch("/data");
|
|
const json = await res.json();
|
|
document.getElementById("data").innerText =
|
|
`Temperature: ${json.temp.toFixed(2)} °C\nHumidity: ${json.humidity.toFixed(2)} %`;
|
|
} catch(e) {
|
|
document.getElementById("data").innerText = "Error fetching sensor data.";
|
|
}
|
|
}
|
|
fetchSensorData();
|
|
setInterval(fetchSensorData, 2000);*/
|
|
</script>
|
|
</body>
|
|
|
|
</html> |