Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@yasugahira0810
Last active December 8, 2018 07:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yasugahira0810/d498a15c5198b7cc3d75347fa68dee6c to your computer and use it in GitHub Desktop.
Save yasugahira0810/d498a15c5198b7cc3d75347fa68dee6c to your computer and use it in GitHub Desktop.
<!-- HTML Example -->
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://obniz.io/js/jquery-3.2.1.min.js"></script>
<script src="https://unpkg.com/obniz@latest/obniz.js"></script>
</head>
<body>
<div id="obniz-debug"></div>
<script>
var obniz = new Obniz("OBNIZ_ID");
obniz.onconnect = async function () {
var servo = obniz.wired("ServoMotor", {signal:0,vcc:3, gnd:2});
servo.angle(100.0);
await obniz.wait(1000);
servo.angle(80.0);
setTimeout(function(){
obniz.close();
if (typeof done === "function") {
done();
}
},1000);
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment