{"id":457,"date":"2016-08-21T14:37:51","date_gmt":"2016-08-21T05:37:51","guid":{"rendered":"http:\/\/bezelie.com\/blog\/?page_id=457"},"modified":"2016-08-21T14:37:51","modified_gmt":"2016-08-21T05:37:51","slug":"btk%e6%98%8e%e3%82%8b%e3%81%95%e3%81%ab%e3%82%88%e3%81%a3%e3%81%a6%e5%96%8b%e3%82%8b%e8%a8%80%e8%91%89%e3%82%92%e5%a4%89%e3%81%88%e3%81%a6%e3%81%bf%e3%82%8b","status":"publish","type":"page","link":"http:\/\/bezelie.com\/blog\/?page_id=457","title":{"rendered":"BTK:\u660e\u308b\u3055\u306b\u3088\u3063\u3066\u558b\u308b\u8a00\u8449\u3092\u5909\u3048\u3066\u307f\u308b"},"content":{"rendered":"<p>\u4ee5\u4e0b\u306e\u30b9\u30b1\u30c3\u30c1\u3092Arduino IDE\u306b\u30b3\u30d4\u30da\u3057\u3001Studuino mini\u306b\u8ee2\u9001\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>Studuino mini\u4e0a\u306e\u5149\u30bb\u30f3\u30b5\u30fc\u3092\u624b\u3067\u8986\u3063\u3066\u6697\u304f\u3059\u308b\u3068\u3001\u30d9\u30bc\u30ea\u30fc\u304c\u558b\u308b\u8a00\u8449\u3068\u52d5\u304d\u304c\u5909\u308f\u308a\u307e\u3059\u3002<\/p>\n<p>\u30fb\u307e\u305a\u306f\u30b9\u30b1\u30c3\u30c1\u3092\u66f8\u304d\u63db\u3048\u3066\u3001\u3057\u3083\u3079\u308b\u8a00\u8449\u3092\u5909\u3048\u3066\u307f\u307e\u3057\u3087\u3046\u3002<br \/>\n\u30fb\u6b21\u306b\u52d5\u304d\u3092\u81ea\u5206\u306a\u308a\u306b\u5909\u3048\u3066\u307f\u307e\u3057\u3087\u3046\u3002<br \/>\n\u30fb\u3046\u307e\u304f\u3044\u3063\u305f\u3089\u3001\u51e6\u7406\u3092\u5207\u308a\u66ff\u3048\u308b\u660e\u308b\u3055\u306e\u5024\u3092\u5909\u3048\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre>\/\/----------------------------------------------------------------------\r\n\/\/ \u30d9\u30bc\u30ea\u30fc\u304a\u3057\u3083\u3079\u308a\u30ad\u30c3\u30c8(BTK) Studuino\u7528\u30b5\u30f3\u30d7\u30eb\u30b9\u30b1\u30c3\u30c1\r\n\/\/ \u6700\u7d42\u66f4\u65b0\uff1a2016\u5e748\u670820\u65e5\u3000by Jun Toyoda (Team Bezelie)\r\n\/\/ \u6a5f\u80fd\uff1a\r\n\/\/ \uff11\uff1a\u96fb\u6e90\u3092\u5165\u308c\u308b\u3068\u3001\u3057\u3083\u3079\u3063\u3066\u52d5\u304f\u3002 \r\n\/\/ \uff12\uff1a\u6697\u304f\u306a\u308b\u3068\u30bb\u30ea\u30d5\u3068\u52d5\u304d\u304c\u5909\u308f\u308b\u3002\r\n\/\/ \uff13\uff1a\u30c7\u30b8\u30bf\u30ebI\/O\u30d4\u30f3\uff15\u756a\u306b\u30b5\u30fc\u30dc\u3092\u3064\u306a\u3050\u3068\u30bb\u30f3\u30bf\u30ea\u30f3\u30b0\u3067\u304d\u308b\u3002\r\n\/\/----------------------------------------------------------------------\r\n#include &lt;Servo.h&gt; \/\/ \u30b5\u30fc\u30dc\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\r\n#include &lt;Wire.h&gt; \/\/ I2C\u901a\u4fe1\u3059\u308b\u305f\u3081\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\r\n#include &lt;AquesTalk.h&gt; \/\/ AquesTalk\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\r\nAquesTalk atp; \/\/ AquesTalk\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5b9a\u7fa9\r\n\r\n\/\/\u30b5\u30fc\u30dc\u521d\u671f\u8a2d\u5b9a Pitch=\u9996\u306e\u7e26\u632f\u308a, Roll=\u9854\u306e\u56de\u8ee2, Yaw=\u4f53\u306e\u56de\u8ee2\r\nconst int svPc = 90; \/\/ \u30b5\u30fc\u30dc\u306e\u4e2d\u5fc3\u89d2\u5ea6\uff08Pitch\uff09 \r\nconst int svRc = 90; \/\/ \u30b5\u30fc\u30dc\u306e\u4e2d\u5fc3\u89d2\u5ea6\uff08Roll\uff09\r\nconst int svYc = 90; \/\/ \u30b5\u30fc\u30dc\u306e\u4e2d\u5fc3\u89d2\u5ea6\uff08Yaw\uff09\r\nint destP = svPc; \/\/ \u30b5\u30fc\u30dc\u306e\u76ee\u6a19\u89d2\u5ea6\uff08Pitch\uff09svPc-40&lt;destP&lt;svPc+20\r\nint destR = svRc; \/\/ \u30b5\u30fc\u30dc\u306e\u76ee\u6a19\u89d2\u5ea6\uff08Roll\uff09 svRc-40&lt;destR&lt;svRc+40\r\nint destY = svYc; \/\/ \u30b5\u30fc\u30dc\u306e\u76ee\u6a19\u89d2\u5ea6\uff08Yaw\uff09 svYc-40&lt;destY&lt;svYc+40\r\nint spd = 10; \/\/ \u30b5\u30fc\u30dc\u306e\u901f\u5ea6\u30020\u304c\u6700\u901f\u3002\r\n\r\n\/\/----------------------------------------------------------------------\r\nvoid setup() \/\/ \u521d\u671f\u8a2d\u5b9a\r\n{\r\n initServo(); \/\/ \u30b5\u30fc\u30dc\u306e\u521d\u671f\u30bb\u30f3\u30bf\u30ea\u30f3\u30b0\r\n atp.SetAccent(120); \/\/ AquesTalk\u58f0\u8272\u6307\u5b9a \u30a2\u30af\u30bb\u30f3\u30c8 0&lt;64&lt;255\r\n atp.SetPitch(3); \/\/ AquesTalk\u58f0\u8272\u6307\u5b9a \u30d4\u30c3\u30c1 0&lt;64&lt;255\r\n atp.SetSpeed(100); \/\/ AquesTalk\u58f0\u8272\u6307\u5b9a \u30b9\u30d4\u30fc\u30c9 50&lt;100&lt;300\r\n atp.Synthe(\"#J\"); \/\/ AquesTalk\u767a\u58f0\u300c\u30c1\u30e3\u30a4\u30e0\uff11\u300d\r\n while(atp.IsBusy()) ; \/\/ AquesTalk\u3000\u9cf4\u308a\u6b62\u3080\u307e\u3067\u5f85\u3064\r\n delay (1000);\r\n}\r\n\/\/----------------------------------------------------------------------\r\nvoid loop() \/\/ \u30e1\u30a4\u30f3\u30eb\u30fc\u30d7\r\n{\r\n if(analogRead(A6) &gt; 200){ \/\/ \u5149\u30bb\u30f3\u30b5\u306e\u5024\u304c200\u4ee5\u4e0a\u306a\u3089\u4ee5\u4e0b\u3092\u5b9f\u884c\r\n atp.Synthe(\"akaruine'-.\"); \/\/ AquesTalk\u767a\u58f0\r\n spd = 10; \/\/ \u30b5\u30fc\u30dc\u306e\u901f\u5ea6\r\n destP = svPc - 40; \/\/ \u9996\u3092\u4e0a\u306b\u5411\u3051\u308b\u6307\u5b9a\r\n servoMove(); \/\/ \u30b5\u30fc\u30dc\u3092\u52d5\u304b\u3059\r\n delay (500); \/\/ 0.5\u79d2\u5f85\u3064\r\n destP = svPc; \/\/ \u9996\u3092\u6c34\u5e73\u306b\u5411\u3051\u308b\u6307\u5b9a\r\n servoMove(); \/\/ \u30b5\u30fc\u30dc\u3092\u52d5\u304b\u3059\r\n }else{\r\n atp.Synthe(\"kuraiyo-.\"); \/\/ AquesTalk\u767a\u58f0\r\n spd = 15; \/\/ \u30b5\u30fc\u30dc\u306e\u901f\u5ea6\r\n destP = svPc + 20; \/\/ \u9996\u3092\u4e0a\u306b\u5411\u3051\u308b\u6307\u5b9a\r\n servoMove(); \/\/ \u30b5\u30fc\u30dc\u3092\u52d5\u304b\u3059\r\n delay (500); \/\/ 0.5\u79d2\u5f85\u3064\r\n destP = svPc; \/\/ \u9996\u3092\u6c34\u5e73\u306b\u5411\u3051\u308b\u6307\u5b9a\r\n servoMove(); \/\/ \u30b5\u30fc\u30dc\u3092\u52d5\u304b\u3059\r\n }\r\n delay (1000); \/\/ 1\u79d2\u5f85\u3064\r\n}\r\n\/\/----------------------------------------------------------------------\r\n\/\/ \u30b5\u30fc\u30dc\u306e\u8a2d\u5b9a\r\nconst int pinSvC = 5; \/\/ \u30b5\u30fc\u30dc(\u30bb\u30f3\u30bf\u30ea\u30f3\u30b0\u7528)\u3092\u30c7\u30b8\u30bf\u30ebI\/O\u306e5\u756a\u306b\u5272\u308a\u5f53\u3066\u308b\r\nconst int pinSvP = 9; \/\/ \u30b5\u30fc\u30dc(Pitch)\u3092\u30c7\u30b8\u30bf\u30ebI\/O\u306e9\u756a\u306b\u5272\u308a\u5f53\u3066\u308b\r\nconst int pinSvR = 10; \/\/ \u30b5\u30fc\u30dc(Roll)\u3092\u30c7\u30b8\u30bf\u30ebI\/O\u306e10\u756a\u306b\u5272\u308a\u5f53\u3066\u308b\r\nconst int pinSvY = 11; \/\/ \u30b5\u30fc\u30dc(Yaw)\u3092\u30c7\u30b8\u30bf\u30ebI\/O\u306e11\u756a\u306b\u5272\u308a\u5f53\u3066\u308b\r\nServo svC; \/\/ \u30b5\u30fc\u30dc\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u4f5c\u308b(\u30bb\u30f3\u30bf\u30ea\u30f3\u30b0\u7528)\r\nServo svP; \/\/ \u30b5\u30fc\u30dc\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u4f5c\u308b(Pitch \u9996\u306e\u7e26\u632f\u308a\u7528)\r\nServo svR; \/\/ \u30b5\u30fc\u30dc\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u4f5c\u308b(Roll \u9854\u306e\u56de\u8ee2\u7528)\r\nServo svY; \/\/ \u30b5\u30fc\u30dc\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u4f5c\u308b(Yaw \u4f53\u306e\u56de\u8ee2\u7528)\r\nint posP = svPc; \/\/ \u5909\u6570\uff1a\u30b5\u30fc\u30dc\u306e\u73fe\u5728\u306e\u89d2\u5ea6(Pitch)\r\nint posR = svRc; \/\/ \u5909\u6570\uff1a\u30b5\u30fc\u30dc\u306e\u73fe\u5728\u306e\u89d2\u5ea6(Roll)\r\nint posY = svYc; \/\/ \u5909\u6570\uff1a\u30b5\u30fc\u30dc\u306e\u73fe\u5728\u306e\u89d2\u5ea6(Yaw)\r\n\r\n\/\/----------------------------------------------------------------------\r\n\/\/\u95a2\u6570\r\nvoid servoMove (){ \/\/ \u30b5\u30fc\u30dc\u3092\u52d5\u304b\u3059\u95a2\u6570\r\n while (posP != destP){\r\n svP.attach(pinSvP); \r\n if (posP &lt; destP){\r\n posP++;\r\n }else{\r\n posP--;\r\n }\r\n svP.write(posP);\r\n delay (spd+2); \r\n }\r\n while (posR != destR){\r\n svR.attach(pinSvR); \r\n if (posR &lt; destR){\r\n posR++;\r\n }else{\r\n posR--;\r\n }\r\n svR.write(posR);\r\n delay (spd+2); \r\n }\r\n while (posY != destY){\r\n svY.attach(pinSvY); \r\n if (posY &lt; destY){\r\n posY++;\r\n }else{\r\n posY--;\r\n }\r\n svY.write(posY);\r\n delay (spd+2); \r\n }\r\n svP.detach ();\r\n svR.detach ();\r\n svY.detach ();\r\n} \r\n\r\nvoid initServo (){ \/\/ \u30b5\u30fc\u30dc\u306e\u521d\u56de\u30bb\u30f3\u30bf\u30ea\u30f3\u30b0\r\n svC.attach(pinSvC); \r\n svP.attach(pinSvP); \r\n svR.attach(pinSvR); \r\n svY.attach(pinSvY); \r\n svC.write(100); \/\/ \u52d5\u4f5c\u78ba\u8a8d\u306e\u305f\u3081\u3001\u308f\u3056\u3068\u305a\u3089\u3059\r\n svP.write(svPc);\r\n svR.write(svRc); \r\n svY.write(svYc);\r\n delay (500); \r\n svC.write(90);\r\n delay (500); \r\n svC.detach ();\r\n svP.detach ();\r\n svR.detach ();\r\n svY.detach ();\r\n}\r\n\r\n\/\/----------------------------------------------------------------------\r\n\/\/ AquesTalk pico LSI\u306b\u95a2\u3059\u308b\u60c5\u5831\r\n\/\/ \u97f3\u58f0\u8a18\u53f7\u5217\u751f\u6210\u30b5\u30fc\u30d3\u30b9 http:\/\/www.a-quest.com\/demo\/pico_kanji2roman.html\r\n\/\/ \u8a18\u8ff0\u30eb\u30fc\u30eb\u3000http:\/\/www.a-quest.com\/download\/manual\/atp3011_datasheet.pdf\r\n\/\/ \u30e9\u30a4\u30d6\u30e9\u30ea\u3000http:\/\/blog-yama.a-quest.com\/?eid=970151\r\n\/\/----------------------------------------------------------------------\r\n\/\/end of file<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u4ee5\u4e0b\u306e\u30b9\u30b1\u30c3\u30c1\u3092Arduino IDE\u306b\u30b3\u30d4\u30da\u3057\u3001Studuino mini\u306b\u8ee2\u9001\u3057\u3066\u304f\u3060\u3055\u3044\u3002 Studuino mini\u4e0a\u306e\u5149\u30bb\u30f3\u30b5\u30fc\u3092\u624b\u3067\u8986\u3063\u3066\u6697\u304f\u3059\u308b\u3068\u3001\u30d9\u30bc\u30ea\u30fc\u304c\u558b\u308b\u8a00\u8449\u3068\u52d5\u304d\u304c\u5909\u308f\u308a\u307e\u3059\u3002 \u30fb\u307e\u305a\u306f\u30b9\u30b1\u30c3\u30c1\u3092 &hellip; <a href=\"http:\/\/bezelie.com\/blog\/?page_id=457\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;BTK:\u660e\u308b\u3055\u306b\u3088\u3063\u3066\u558b\u308b\u8a00\u8449\u3092\u5909\u3048\u3066\u307f\u308b&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-457","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"http:\/\/bezelie.com\/blog\/index.php?rest_route=\/wp\/v2\/pages\/457","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bezelie.com\/blog\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/bezelie.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/bezelie.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/bezelie.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=457"}],"version-history":[{"count":1,"href":"http:\/\/bezelie.com\/blog\/index.php?rest_route=\/wp\/v2\/pages\/457\/revisions"}],"predecessor-version":[{"id":459,"href":"http:\/\/bezelie.com\/blog\/index.php?rest_route=\/wp\/v2\/pages\/457\/revisions\/459"}],"wp:attachment":[{"href":"http:\/\/bezelie.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=457"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}