obnizソフト作成
code:html
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"/>
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="https://unpkg.com/obniz@3.x/obniz.js" crossorigin="anonymous" ></script>
</head>
<body>
<div id="obniz-debug"></div>
<div class="container">
<div class="text-center">
<h3>Control LED from Browser</h3>
<button class="btn btn-primary" id="on">LED ON</button>
<button class="btn btn-primary" id="off">LED OFF</button>
</div>
</div>
<script>
//type in your obniz ID
var obniz = new Obniz("OBNIZ_ID_HERE");
//during obniz connection
obniz.onconnect = async function() {
//wire LED to obniz
//io0: anode
//io1: cathode
var led = obniz.wired("LED", { anode: 0, cathode: 1 });
//if the "on" button is clicked
$("#on").click(function() {
led.on();
});
//if the "off" button is clicked
$("#off").click(function() {
led.off();
});
};
</script>
</body>
</html>