<html>
<head>
</head>
<body>
<script src="https://www.puck-js.com/puck.js"></script>
<script>
var d = new Date();
var n = Math.round(d.getTime()/1000);
var puckCommand = String.fromCharCode(16)+"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>
I never got \x10 working in the code. As you said, there must be some HTML escaping going on somewhere.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
The final working code was:
I never got \x10 working in the code. As you said, there must be some HTML escaping going on somewhere.