Arduino_serial/index.html
2023-05-24 19:25:56 +03:00

37 lines
1.2 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Welcome file</title>
<link rel="stylesheet" href="https://stackedit.io/style.css" />
</head>
<body class="stackedit">
<div class="stackedit__html">
<h1 id="состояние-ардуины-отображается-в-браузере"><em>Состояние ардуины отображается в браузере:</em></h1>
<h2 id="ответ-на-hello">ответ на “hello”</h2>
<p>Пришел ответ: <span id="answer1"></span> </p>
<h2 id="состояние-ардуины-равно">Состояние ардуины равно</h2>
<p>Пришел ответ:<span id="answer2"></span></p>
</div>
<script>
fetch('/hello').then((response) => response.text())
.then((response) => {
const elem = document.getElementById("answer1");
elem.innerHTML = response;
});
setInterval(() => {
fetch('/status').then((response) => response.text())
.then((response) => {
const elem = document.getElementById("answer2");
elem.innerHTML = response;
});
}, 1000);
</script>
</body>
</html>