Skip to content

Instantly share code, notes, and snippets.

@stresslimit
Created November 20, 2015 14:56
Show Gist options
  • Save stresslimit/2849cf36e2bf15af82be to your computer and use it in GitHub Desktop.
Save stresslimit/2849cf36e2bf15af82be to your computer and use it in GitHub Desktop.
<html>
<head>
<script src="http://apps.littlebitscloud.cc/api-http/littleBitsAPI.min.js"></script>
<script>
function set_auth(form) {
var v = {
access_token: form.access_token.value,
device_id: form.cloudBit_id.value
}
window.littleBitsAPI = littleBitsAPI.defaults(v)
}
</script>
</head>
<body>
<form onSubmit="event.preventDefault(); set_auth(this)">
<p>token: <input name="access_token"></p>
<p>cloudBit id: <input name="cloudBit_id"></p>
<button>set auth</button>
</form>
<button onClick="littleBitsAPI.input( function(data) {
console.log(data.percent)
document.getElementById('input_display').innerHTML = data.percent
})">Input!</button>
<div id="input_display"></div>
<button onClick="littleBitsAPI.output()">Output!</button>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment