-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.html
More file actions
34 lines (28 loc) · 812 Bytes
/
template.html
File metadata and controls
34 lines (28 loc) · 812 Bytes
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Generic Sensor API Template</title>
</head>
<body>
Version 5.0
<div id="output">
</div>
<script>
const gy = new Gyroscope();
const ac = new Accelerometer();
const output = document.getElementById("output");
ac.start();
ac.onreading = () =>{
console.log("Accelerometer " + ac.x);
output.innerHTML += "Accelerometer x:" + ac.x + " y:" + ac.y + "z:" + ac.z + "<hr>";
}
gy.start();
gy.onreading = () =>{
console.log("Gyroscope " + gy.x);
output.innerHTML += "Gyroscope x:" + gy.x + " y:" + gy.y + "z:" + gy.z + "<hr>";
}
</script>
</body>
</html>