Paste Search Dynamic
Recent pastes
Untitled
  1. <DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Accelerometer</title>
  5. </head>
  6. <body>
  7.  
  8. <h1>Accelerometer Testing</h1>
  9.  
  10. <h3>X-axis: <span id="xax"></span></h3>
  11. <h3>Y-axis: <span id="yax"></span></h3>
  12. <h3>Z-axis: <span id="zax"></span></h3>
  13.  
  14. <script>
  15. var acl = new Accelerometer({frequency: 60});
  16. var x = document.getElementById("xax");
  17. var y = document.getElementById("yax");
  18. var z = document.getElementById("zax");
  19. acl.addEventListener('reading', () => {
  20.   x.innerHTML = acl.x;
  21.   y.innerHTML = acl.y;
  22.   z.innerHTML = acl.z;
  23. });
  24.  
  25. acl.start();
  26. </script>
  27. </body>
  28. </html>
Parsed in 0.007 seconds