23 lines
397 B
HTML
23 lines
397 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Accelerometer test</title>
|
|
</head>
|
|
<script>
|
|
|
|
const acl = new GravitySensor({ frequency: 60 });
|
|
acl.addEventListener("reading", () => {
|
|
document.body.innerHTML = `<pre>
|
|
Acceleration along the X-axis ${acl.x}
|
|
Acceleration along the Y-axis ${acl.y}
|
|
Acceleration along the Z-axis ${acl.z}
|
|
</pre>`;
|
|
});
|
|
|
|
acl.start();
|
|
|
|
</script>
|
|
|
|
<body>
|
|
</body>
|
|
</html> |