-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
174 lines (133 loc) · 6.36 KB
/
index.html
File metadata and controls
174 lines (133 loc) · 6.36 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<!-- <php
header("Cache-Control: no-cache, must-revalidate"); // HTTP 1.1
header("Pragma: no-cache"); // HTTP 1.0
header("Expires: Wed, 1 Jan 2020 00:00:00 GMT"); // Anytime in the past
> -->
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<title>PID Control</title>
<style>
html {
font-family: Helvetica;
display: inline-block;
margin: 0px auto;
text-align: center;
}
body {
margin-top: 50px;
}
h1 {
color: #444444;
margin: 50px auto 30px;
}
h3 {
color: #444444;
margin-bottom: 50px;
}
.button {
display: block;
width: 80px;
background-color: #1abc9c;
border: none;
color: white;
padding: 13px 30px;
text-decoration: none;
font-size: 25px;
margin: 0px auto 35px;
cursor: pointer;
border-radius: 4px;
}
.button-on {
background-color: #1abc9c;
}
.button-on:active {
background-color: #16a085;
}
.button-off {
background-color: #34495e;
}
.button-off:active {
background-color: #2c3e50;
}
p {
font-size: 14px;
color: #888;
margin-bottom: 10px;
}
</style>
<script>
// GET Request
async function fetchAsync(url) {
let response = await fetch(url);
let data = await response.json();
return data;
}
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
</script>
</head>
<script>
</script>
<body>
<!-- submit multiple forms with a single submit button -->
<h1>ESP32 with ThingSpeak Server</h1>
<form>
<fieldset>
<iframe name="dummyframe" id="dummyframe" style="display: none;"></iframe>
<div class="form-control" target="dummyframe">
<input type="number" id="input_angle" placeholder="Enter the target angle" required />
</div>
<div class="form-control" target="dummyframe">
<input type="number" step="any" min="0" max="100" id="kp" placeholder="Enter K_p" required />
</div>
<div class="form-control" target="dummyframe">
<input type="number" step="any" min="0" max="100" id="kd" placeholder="Enter K_d" required />
</div>
<div class="form-control" target="dummyframe">
<input type="number" step="any" min="0" max="100" id="ki" placeholder="Enter K_i" required />
</div>
<!-- <input type="submit" value="Send" class="submit-btn" onclick="bulkPush()" /> -->
<button onclick="bulkPush()" value="Submit">Send</button>
</fieldset>
<!-- button onclick bulkpush -->
</form>
<iframe width="450" height="260" style="border: 1px solid #cccccc;"
src="https://thingspeak.com/channels/1825221/charts/1?bgcolor=%23ffffff&color=%23d62020&dynamic=true&results=75&title=Input+Angle&type=line&xaxis=Time%28+Difference+in+Time+scaled+10x%29&yaxis=Angle+%28in+degrees%29&yaxismax=360&yaxismin=0"></iframe>
<iframe width="450" height="260" style="border: 1px solid #cccccc;"
src="https://thingspeak.com/channels/1825221/charts/2?bgcolor=%23ffffff&color=%23d62020&dynamic=true&results=75&title=Angle+traversed&type=line&xaxis=Time%28+Difference+in+Time+scaled+10x+%29&yaxis=Angle+%28in+degrees%29&yaxismin=0"></iframe>
<iframe width="450" height="260" style="border: 1px solid #cccccc;"
src="https://thingspeak.com/channels/1825221/charts/3?bgcolor=%23ffffff&color=%23d62020&dynamic=true&results=75&title=Error%28u%29&type=line&xaxis=Time%28+Difference+in+Time+scaled+10x%29&yaxis=PID+Error"></iframe>
<br>
<iframe width="450" height="260" style="border: 1px solid #cccccc;" src="https://thingspeak.com/channels/1856865/charts/6?bgcolor=%23ffffff&color=%23d62020&dynamic=true&results=75&title=Current+Angle&type=line&xaxis=Time%28+Difference+in+Time+scaled+10x+%29&yaxis=Angle+%28Degrees%29&yaxismin=0"></iframe>
<iframe width="450" height="260" style="border: 1px solid #cccccc;" src="https://thingspeak.com/channels/1856865/charts/5?bgcolor=%23ffffff&color=%23d62020&dynamic=true&results=75&title=Error&type=line&xaxis=Time%28+Difference+in+Time+scaled+10x+%29&yaxis=U"></iframe>
<iframe width="450" height="260" style="border: 1px solid #cccccc;" src="https://thingspeak.com/channels/1856865/charts/7?bgcolor=%23ffffff&color=%23d62020&dynamic=true&results=75&title=Power+Given&type=line&xaxis=Time%28+Difference+in+Time+scaled+10x+%29&yaxis=PWR"></iframe>
<br>
<iframe width="450" height="260" style="border: 1px solid #cccccc;"
src="https://thingspeak.com/channels/1825221/charts/5?bgcolor=%23ffffff&color=%23d62020&dynamic=true&results=60&title=Proportionality+constant&type=line"></iframe>
<iframe width="450" height="260" style="border: 1px solid #cccccc;"
src="https://thingspeak.com/channels/1825221/charts/6?bgcolor=%23ffffff&color=%23d62020&dynamic=true&results=60&title=Differentiation+Constant&type=line"></iframe>
<iframe width="450" height="260" style="border: 1px solid #cccccc;"
src="https://thingspeak.com/channels/1825221/charts/7?bgcolor=%23ffffff&color=%23d62020&dynamic=true&results=60&type=line&update=15"></iframe>
<script>
function bulkPush() {
// console.log('Hi')
// let angle = document.getElementById("input_angle").value;
// let kp = document.getElementById("kp").value;
// let ki = document.getElementById("ki").value;
// let kd = document.getElementById("kd").value;
// console.log(angle);
// console.log(kp);
// console.log(ki);
// console.log(kd);
// const url = 'https://api.thingspeak.com/update?api_key=S6W8OO70L5TBDX50&field1=' + angle + '&field2=' + kp + '&field3=' + kd + '&field4=' + ki;
// console.log(url);
// fetchAsync(url)
// .then(data => console.log(data))
// .catch(reason => console.log(reason.message));
}
</script>
</body>
</html>