Last active
June 14, 2017 16:12
-
-
Save conoro/f96bf4f2920cb9027d261262ed0bfa82 to your computer and use it in GitHub Desktop.
Web Bluetooth Set/Get Time Puck.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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