{"id":7350,"date":"2025-02-01T17:29:50","date_gmt":"2025-02-01T08:29:50","guid":{"rendered":"https:\/\/robot.e-nat.org\/?p=7350"},"modified":"2025-02-02T16:01:27","modified_gmt":"2025-02-02T07:01:27","slug":"motor_pair%e3%83%a2%e3%82%b8%e3%83%a5%e3%83%bc%e3%83%ab%e3%81%a7%e3%83%ad%e3%83%9c%e3%83%83%e3%83%88%e3%82%92%e5%8b%95%e3%81%8b%e3%81%99","status":"publish","type":"post","link":"https:\/\/robot.e-nat.org\/?p=7350","title":{"rendered":"motor_pair\u30e2\u30b8\u30e5\u30fc\u30eb\u3067\u30ed\u30dc\u30c3\u30c8\u3092\u52d5\u304b\u3059"},"content":{"rendered":"\n<p>\u91d1\u5b8f\u548c\u5be6\u3067\u3059\u3002<br>Spike Prime\u3067\u30ed\u30dc\u30c3\u30c8\u3092\u7d44\u307f\u7acb\u3066\u308b\u5834\u5408\u3001\u5de6\u53f3\u306e\u4e8c\u3064\u306e\u30e2\u30fc\u30bf\u30fc\u3067\u30ed\u30dc\u30c3\u30c8\u3092\u8d70\u3089\u305b\u308b\u3053\u3068\u304c\u591a\u3044\u3060\u308d\u3046\u3002motor_pair\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u4f7f\u3046\u3068\u3001\u5de6\u53f3\u306e2\u3064\u306e\u30e2\u30fc\u30bf\u30fc\u3092\u30da\u30a2\u306b\u3057\u3066\u52d5\u304b\u3059\u3053\u3068\u304c\u3067\u304d\u308b\u3002\u4eca\u56de\u306f\u4e00\u756a\u7c21\u5358\u306a\u4f8b\u3092\u7d39\u4ecb\u3059\u308b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code has-cyan-bluish-gray-background-color has-background\"><code>import motor_pair\nfrom hub import port\nimport time\n\nmotor_pair.pair(motor_pair.PAIR_1, port.C, port.D)\nmotor_pair.move(motor_pair.PAIR_1, 0)\ntime.sleep(3)\nmotor_pair.stop(motor_pair.PAIR_1)<\/code><\/pre>\n\n\n\n<p>import motor_pair\u3067motor_pair\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u30a4\u30f3\u30dd\u30fc\u30c8\u3057\u3066\u3001motor_pair.pair()\u3067\u30e2\u30fc\u30bf\u30fc\u30da\u30a2\u3092\u4f5c\u308b\u3002\u8907\u6570\u306e\u30e2\u30fc\u30bf\u30fc\u30da\u30a2\u3092\u4f5c\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u306e\u3067\u3001motor_pair.PAIR_1\u306e\u3088\u3046\u306bPAIR_n\u3068\u3044\u3046\u5b9a\u6570\u3067\u9023\u756a\u3092\u6307\u5b9a\u3067\u304d\u308b\u3002\u7b2c\u4e8c\u5f15\u6570\u3001\u7b2c\u4e09\u5f15\u6570\u306bport.C, port.D\u306e\u3088\u3046\u306b\u5de6\u53f3\u306e\u30e2\u30fc\u30bf\u30fc\u3092\u6307\u5b9a\u3059\u308b\u3002move()\u3067\u30ed\u30dc\u30c3\u30c8\u306f\u52d5\u304f\u304c\u3001move()\u306e\u7b2c\u4e8c\u5f15\u6570\u306f\u30b9\u30c6\u30a2\u30ea\u30f3\u30b0\u3060\u3002-100\u304b\u3089100\u306e\u7bc4\u56f2\u3067\u6307\u5b9a\u3067\u304d\u308b\u3002motor_pair.move(motor_pair.PAIR_1, 50)\u306e\u3088\u3046\u306b\u3059\u308b\u3068\u30ed\u30dc\u30c3\u30c8\u306f\u53f3\u65cb\u56de\u3059\u308b\u3002<br>stop()\u3067\u30ed\u30dc\u30c3\u30c8\u306f\u6b62\u307e\u308b\u3002<br>move()\u3068stop\u306e\u9593\u306b\u3042\u308btime.sleep(3)\u304c\u30ed\u30dc\u30c3\u30c8\u304c\u8d70\u308b\u6642\u9593\u3060\u3002\u5358\u4f4d\u306fSecond\uff08\u79d2\uff09\u3060\u304c\u3001time.sleep(0.5)\u306e\u3088\u3046\u306b\u5c0f\u6570\u70b9\u4ee5\u4e0b\u306e\u5024\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u308b\u3002<br>time.sleep()\u306b\u306ftime.sleep_ms()\u3068\u3044\u3046\u30d0\u30ea\u30a8\u30fc\u30b7\u30e7\u30f3\u3082\u3042\u308a\u3001\u3053\u3061\u3089\u306f\u30df\u30eaSecond\u3067\u6642\u9593\u3092\u6307\u5b9a\u3067\u304d\u308b\u3002\u3061\u306a\u307f\u306btime.sleep_ms(200)\u306f0.2\u79d2\u30b9\u30ea\u30fc\u30d7\u3059\u308b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code has-cyan-bluish-gray-background-color has-background\"><code>motor_pair.move_tank(motor_pair.PAIR_1, 500,0)\ntime.sleep_ms(500)\nmotor_pair.move_tank(motor_pair.PAIR_1, 500,500)\ntime.sleep(2)\nmotor_pair.stop(motor_pair.PAIR_1)\nmotor_pair.move_tank(motor_pair.PAIR_1, -500,-500)\ntime.sleep(2)\nmotor_pair.stop(motor_pair.PAIR_1)<\/code><\/pre>\n\n\n\n<p>move_tank()\u3092\u4f7f\u3046\u3068\u5de6\u53f3\u306e\u30e2\u30fc\u30bf\u30fc\u306e\u30b9\u30d4\u30fc\u30c9\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3002<br>move_tank(motor_pair.PAIR_1, 500,0)\u306f\u5de6\u5074\u306e\u30e2\u30fc\u30bf\u30fc\u3060\u3051\u304c\u56de\u308b\u306e\u3067\u53f3\u6298\u3059\u308b\u3002<br>move_tank(motor_pair.PAIR_1, 500,500)\u306f\u76f4\u9032\u3059\u308b\u3002<br>motor_pair.move_tank(motor_pair.PAIR_1, -500,-500)\u306f\u5f8c\u9000\u3059\u308b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u91d1\u5b8f\u548c\u5be6\u3067\u3059\u3002Spike Prime\u3067\u30ed\u30dc\u30c3\u30c8\u3092\u7d44\u307f\u7acb\u3066\u308b\u5834\u5408\u3001\u5de6\u53f3\u306e\u4e8c\u3064\u306e\u30e2\u30fc\u30bf\u30fc\u3067\u30ed\u30dc\u30c3\u30c8\u3092\u8d70\u3089\u305b\u308b\u3053\u3068\u304c &hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[41],"tags":[43,23,15,14],"class_list":["post-7350","post","type-post","status-publish","format-standard","hentry","category-python","tag-python-2","tag-lego","tag-15","tag-14","latest_post"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/robot.e-nat.org\/index.php?rest_route=\/wp\/v2\/posts\/7350","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/robot.e-nat.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/robot.e-nat.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/robot.e-nat.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/robot.e-nat.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7350"}],"version-history":[{"count":5,"href":"https:\/\/robot.e-nat.org\/index.php?rest_route=\/wp\/v2\/posts\/7350\/revisions"}],"predecessor-version":[{"id":7362,"href":"https:\/\/robot.e-nat.org\/index.php?rest_route=\/wp\/v2\/posts\/7350\/revisions\/7362"}],"wp:attachment":[{"href":"https:\/\/robot.e-nat.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7350"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/robot.e-nat.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7350"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/robot.e-nat.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7350"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}