-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpage.h
58 lines (54 loc) · 1.39 KB
/
webpage.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
const char FIRMWARE_page[] PROGMEM = R"=====(
<!DOCTYPE html>
<html>
<body>
<form method='POST' action='/firmwareupdate' enctype='multipart/form-data' id='upload_form'>
<input type='file' name='update'>
<input type='submit' value='upload & update'>
</form>
</body>
</html>
)=====";
const char INDEX_page[] PROGMEM = R"=====(
<!DOCTYPE html>
<html>
<style>
.card{
max-width: 400px;
min-height: 250px;
background: #02b875;
padding: 30px;
box-sizing: border-box;
color: #FFF;
margin:20px;
box-shadow: 0px 2px 18px -4px rgba(0,0,0,0.75);
}
</style>
<body>
<div class="card">
<h4>The ESP32 Update web page without refresh</h4><br>
<h1>Sensor Value:<span id="ADCValue">0</span></h1><br>
<h1>Vyliz mi prdel</h1><br>
<br><a href="https://circuits4you.com">Circuits4you.com</a>
<br><a href="/firmware">Update firmware</a>
</div>
<script>
setInterval(function() {
// Call a function repetatively with 2 Second interval
getData();
}, 2000); //2000mSeconds update rate
function getData() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("ADCValue").innerHTML =
this.responseText;
}
};
xhttp.open("GET", "readADC", true);
xhttp.send();
}
</script>
</body>
</html>
)=====";