なんか調子わるかったらOS更新でなおす
https://docs.obniz.com/ja/reference/cloud/device-management/remote-os-update-ota
----------------------------------------------------------------------------------------------------------
#obniz のブロックプログラムで作った仕組みを外部からの Webhook をトリガーにして動かす(アプリのインストールを利用) - Qiita
------------------------------------------------------------------------------------------
html形式は以下のとおり
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
crossorigin="anonymous"
></script>
<script
src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
crossorigin="anonymous"
></script>
<link
rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css"
/>
</head>
<body>
<h3 id="bploading" style="text-align:center;">LOADING...</h3>
<div id="OBNIZ_OUTPUT"></div>
<br />
<script
src="https://unpkg.com/obniz@latest/obniz.js"
crossorigin="anonymous"
></script>
<script
src="https://unpkg.com/obniz-parts-kits@0.16.0/iothome/index.js"
crossorigin="anonymous"
></script>
<script
src="https://unpkg.com/obniz-parts-kits@0.16.0/airobot/index.js"
crossorigin="anonymous"
></script>
<script
src="https://unpkg.com/obniz-parts-kits@0.16.0/ui/index.js"
crossorigin="anonymous"
></script>
<script
src="https://unpkg.com/obniz-parts-kits@0.16.0/ai/howler2.1.2/howler.js"
crossorigin="anonymous"
></script>
<script
src="https://unpkg.com/obniz-parts-kits@0.16.0/ai/opencv3.4/opencv.js"
crossorigin="anonymous"
></script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@3.3.0"></script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow-models/mobilenet@2.1.0"></script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow-models/posenet@2.2.2"></script>
<script
src="https://unpkg.com/obniz-parts-kits@0.16.0/ai/clmtrackr/clmtrackr.js"
crossorigin="anonymous"
></script>
<script
src="https://unpkg.com/obniz-parts-kits@0.16.0/ai/clmtrackr/emotion_classifier.js"
crossorigin="anonymous"
></script>
<script
src="https://unpkg.com/obniz-parts-kits@0.16.0/ai/clmtrackr/emotionmodel.js"
crossorigin="anonymous"
></script>
<script
src="https://unpkg.com/obniz-parts-kits@0.16.0/ai/clmtrackr/model_pca_20_svm.js"
crossorigin="anonymous"
></script>
<script
src="https://unpkg.com/obniz-parts-kits@0.16.0/ai/index.js"
crossorigin="anonymous"
></script>
<script
src="https://unpkg.com/obniz-parts-kits@0.16.0/storage/index.js"
crossorigin="anonymous"
></script>
<script>
$("#bploading").text("RUNNING...");
(async function(){
var obniz, button, button2, button3, button4, button5, servomotor, dcmotor;
obniz = new Obniz('4998-4317');
await obniz.connectWait();
button = new ObnizUI.Button('forward');
button2 = new ObnizUI.Button('back');
button3 = new ObnizUI.Button('45');
button4 = new ObnizUI.Button('90');
button5 = new ObnizUI.Button('135');
servomotor = obniz.wired("ServoMotor",{"signal":2, "vcc":1, "gnd":0});
dcmotor = obniz.wired("DCMotor",{"forward":7, "back":11});
servomotor.angle(90);
while (true) {
await ObnizUI.Util.wait(0);
if (button.isClicked()) {
dcmotor.move(true);
await obniz.wait(600);
dcmotor.stop();
} else {
if (button2.isClicked()) {
dcmotor.move(false);
await obniz.wait(600);
dcmotor.stop();
} else {
if (button3.isClicked()) {
servomotor.angle(45);
} else {
if (button4.isClicked()) {
servomotor.angle(90);
} else {
if (button5.isClicked()) {
servomotor.angle(135);
}
}
}
}
}
}
})();
</script>
</body>
</html>
obnizでブロックプログラムをxml保存してもシステムがかわるとうごかん
よってスクショをのせておく イフが入れ子になっていくのがコツだった
サーボモータで角度設定したあと休止を入れると過電流となりシステムダウンした!
DCモータでは動きっぱなしにするとこれまた過電流になるげな。。。。
0 件のコメント:
コメントを投稿