Skip to content

Instantly share code, notes, and snippets.

@conoro
Last active June 14, 2017 16:12
Show Gist options
  • Save conoro/f96bf4f2920cb9027d261262ed0bfa82 to your computer and use it in GitHub Desktop.
Save conoro/f96bf4f2920cb9027d261262ed0bfa82 to your computer and use it in GitHub Desktop.
Web Bluetooth Set/Get Time Puck.js
<html>
<head>
</head>
<body>
<script src="https://espruino.github.io/js/puck.js"></script>
<script>
var d = new Date();
var n = Math.round(d.getTime()/1000);
var puckCommand = "setTime(" + n + ")\n";
</script>
<button onclick="Puck.write(puckCommand);">Set The Time</button>
<button onclick="Puck.eval('new Date().toString()',function(x) { console.log(x); })">Get The Time</button>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment