{"id":5957,"date":"2019-03-28T09:21:12","date_gmt":"2019-03-28T00:21:12","guid":{"rendered":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/?p=5957"},"modified":"2019-03-28T09:21:12","modified_gmt":"2019-03-28T00:21:12","slug":"mbed-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%9f%e3%83%ad%e3%83%9c%e3%83%83%e3%83%88%e4%bd%9c%e6%88%90%e3%80%80%e7%ac%ac5%e5%9b%9e","status":"publish","type":"post","link":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/archives\/5957","title":{"rendered":"mbed \u3092\u4f7f\u3063\u305f\u30ed\u30dc\u30c3\u30c8\u4f5c\u6210\u3000\u7b2c5\u56de"},"content":{"rendered":"<div class=\"veu_autoEyeCatchBox\"><img loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"562\" src=\"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2019\/03\/no5_01.png\" class=\"attachment-large size-large wp-post-image\" alt=\"\" srcset=\"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2019\/03\/no5_01.png 854w, https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2019\/03\/no5_01-300x225.png 300w, https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2019\/03\/no5_01-768x576.png 768w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/div>\n<h1><strong>\u30e2\u30fc\u30bf\u5236\u5fa1\u3057\u3066\u307f\u308b<\/strong><\/h1>\n<p>&nbsp;<\/p>\n<h2><strong>\u306f\u3058\u3081\u306b<\/strong><\/h2>\n<p>\u4eca\u56de\u306f\u30ed\u30dc\u30c3\u30c8\u306e\u95a2\u7bc0\u3067\u4f7f\u7528\u3059\u308b\u30e2\u30fc\u30bf\u306e\u5236\u5fa1\u306b\u3064\u3044\u3066\u8a18\u8f09\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u30e2\u30fc\u30bf\u3068\u3044\u3063\u3066\u3082\u3001\u69d8\u3005\u306a\u7a2e\u985e\u306e\u30e2\u30fc\u30bf\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u30ed\u30dc\u30c3\u30c8\u306e\u95a2\u7bc0\u3092\u5236\u5fa1\u3059\u308b\u3068\u3044\u3046\u89b3\u70b9\u3067\u7740\u76ee\u3059\u308b\u3068\u3001\u7279\u5b9a\u306e\u89d2\u5ea6\u307e\u3067\u5236\u5fa1\u3067\u304d\u308b\u3053\u3068\u3001\u5236\u5fa1\u5f8c\u306e\u72b6\u614b\u3092\u4fdd\u6301\u3067\u304d\u308b\u3053\u304c\u5fc5\u8981\u3068\u306a\u3063\u3066\u304d\u307e\u3059\u3002<\/p>\n<p>\u3053\u308c\u3089\u306e\u70b9\u3067\u5e02\u8ca9\u88fd\u54c1\u3092\u63a2\u3059\u3068\u30b5\u30fc\u30dc\u30e2\u30fc\u30bf\u304c\u6700\u3082\u76f8\u5fdc\u3057\u3044\u3068\u601d\u3044\u307e\u3059\u306e\u3067\u3001\u30b5\u30fc\u30dc\u30e2\u30fc\u30bf\u3092\u4f7f\u3063\u305f\u5236\u5fa1\u3057\u3066\u307f\u3088\u3046\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<h2><strong>\u30b5\u30fc\u30dc\u30e2\u30fc\u30bf\u306b\u3064\u3044\u3066<\/strong><\/h2>\n<p>\u30b5\u30fc\u30dc\u30e2\u30fc\u30bf\u306f\u3001\u30d1\u30eb\u30b9\u3092\u53d7\u4fe1\u3057\u305d\u306e\u30c7\u30e5\u30fc\u30c6\u30a3\u6bd4\u3067\u56de\u8ee2\u89d2\u5ea6\u3092\u5236\u5fa1\u3059\u308b\u30e2\u30fc\u30bf\u3067\u3059\u3002<\/p>\n<p>\u30d1\u30eb\u30b9\u5e45\u3068\u3057\u3066\u306f1ms\u304b\u30892ms\u7a0b\u5ea6\u3067\u3059\u3002<\/p>\n<p>\u4eca\u56de\u4f7f\u7528\u3059\u308b\u306e\u306f\u3001Kuman\u3068\u3044\u3046\u30e1\u30fc\u30ab\u306eSG90\u3068\u3044\u3046\u30de\u30af\u30ed\u30b5\u30fc\u30dc\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n<table>\n<tbody>\n<tr>\n<td style=\"width: 133px;\">\u88fd\u54c1\u540d<\/td>\n<td style=\"width: 339px;\">SG90 \u30de\u30a4\u30af\u30ed\u30b5\u30fc\u30dc<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 133px;\">\u30e1\u30fc\u30ab\u30fc<\/td>\n<td style=\"width: 339px;\">Kuman<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 133px;\">\u6982\u8981<\/td>\n<td style=\"width: 339px;\">\n<ul>\n<li>\uff30\uff37\uff2d\u30b5\u30a4\u30af\u30eb\uff1a20ms<\/li>\n<li>\u5236\u5fa1\u30d1\u30eb\u30b9\uff1a0.5ms\uff5e2.4ms<\/li>\n<li>\u5236\u5fa1\u89d2\uff1a\u00b1\u7d0490\u00b0\uff08180\u00b0\uff09<\/li>\n<li>\u52d5\u4f5c\u901f\u5ea6\uff1a0.1s\uff0f60\u00b0<\/li>\n<li>\u52d5\u4f5c\u96fb\u5727\uff1a4.8\uff36\uff08\uff5e5\uff36\uff09<\/li>\n<li>\u6e29\u5ea6\u7bc4\u56f2\uff1a0\u2103\uff5e55\u2103<\/li>\n<li>\u5916\u5f62\u5bf8\u6cd5\uff1a22.2\u00d711.8\u00d731\u339c<\/li>\n<li>\u91cd\u91cf\uff1a\uff19g<\/li>\n<\/ul>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 133px;\">\u5024\u6bb5<\/td>\n<td style=\"width: 339px;\">\uff14\uff10\uff10\u5186<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>\u30b5\u30fc\u30dc\u30e2\u30fc\u30bf\u304b\u3089\u306f3\u672c\u7dda\u304c\u51fa\u3066\u304a\u308a\u3001\u8336\u8272\u304cGND\u7dda\u3001\u8d64\u304c\u96fb\u6e90\uff3b\uff0bV\uff3d\u3001\u6a59\u304c\u5236\u5fa1\u4fe1\u53f7\u5236\u5fa1\u4fe1\u53f7\u7528\u306e\u7dda\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5960\" src=\"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2019\/03\/no5_01.png\" alt=\"\" width=\"854\" height=\"640\" srcset=\"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2019\/03\/no5_01.png 854w, https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2019\/03\/no5_01-300x225.png 300w, https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2019\/03\/no5_01-768x576.png 768w\" sizes=\"auto, (max-width: 854px) 100vw, 854px\" \/><\/p>\n<p>mbed\u3068\u306e\u63a5\u7d9a\u306f\u4ee5\u4e0b\u306e\u3068\u304a\u308a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5961\" src=\"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2019\/03\/no5_02.png\" alt=\"\" width=\"640\" height=\"130\" srcset=\"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2019\/03\/no5_02.png 640w, https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2019\/03\/no5_02-300x61.png 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>SG90\u306e\u8d64\u306b\u96fb\u6e90(5V)\u3092\u63a5\u7d9a\u3057\u3001\u8336\u3092GND\u306b\u63a5\u7d9a\u3057\u307e\u3059\u3002<br \/>\nmbed\u3068\u306e\u63a5\u7d9a\u306f\u3001D2\u306e\u30c7\u30fc\u30bf\u30dd\u30fc\u30c8\u3092SG90\u306e\u6a59\u306b\u63a5\u7d9a\u3057\u307e\u3059\u3002<br \/>\n3\u672c\u63a5\u7d9a\u3059\u308b\u3060\u3051\u306a\u306e\u3067\u3001\u308f\u308a\u3068\u7c21\u5358\u306b\u914d\u7dda\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2><strong>\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u306b\u3064\u3044\u3066<\/strong><\/h2>\n<p>SG90\u3092\u5236\u5fa1\u3059\u308b\u70ba\u306bPwmOut(\u30d1\u30eb\u30b9\u5e45\u5909\u8abf\u51fa\u529b)\u30af\u30e9\u30b9\u3092\u7d99\u627f\u3057\u305fServoSg90\u30af\u30e9\u30b9\u3092C++\u3067\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002<\/p>\n<pre class=\"lang:default highlight:0 decode:true\">\/***************************************** \r\n* ServoSg90.h\r\n *****************************************\/\r\n#ifndef SV_SG90_H\r\n#define SV_SG90_H\r\n#include \"mbed.h\"\r\n#include \"PwmOut.h\"\r\n\r\nclass ServoSg90: public PwmOut\r\n{\r\npublic:\r\n    \/* \u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf *\/\r\n    ServoSg90( PinName  port ):PwmOut( port ){}\r\n    \/* \u521d\u671f\u5316\u51e6\u7406 *\/\r\n    void init();\r\n    \/* \u56de\u8ee2\u51e6\u7406 *\/\r\n    int  roll( unsigned int angle );\r\n};\r\n\r\n#endif \/* SV_SG90_H *\/<\/pre>\n<pre class=\"lang:default highlight:0 decode:true \">\/***************************************** \r\n * ServoSg90.cpp\r\n *****************************************\/\r\n#include \"ServoSg90.h\"\r\n\r\n#define SG_PERIOD 20     \/* 20[msec] *\/\r\n#define SG_NEUTRAL 1450  \/* 90\u00b0 1450[usec] *\/\r\n\/* \u521d\u671f\u5316\u51e6\u7406 *\/\r\nvoid ServoSg90::init(){\r\n    \/* \u5468\u671f\u306e\u8a2d\u5b9a\u3092\u884c\u3046 *\/\r\n    period_ms( SG_PERIOD );\r\n    \/* 90\u00b0\u306b\u89d2\u5ea6\u8abf\u6574 *\/\r\n    pulsewidth_us( SG_NEUTRAL );\r\n}\r\n\/* \u56de\u8ee2\u51e6\u7406 *\/\r\nint ServoSg90::roll( unsigned int angle ){\r\n    int lPulseWidth = 0;\r\n    \/* \u56de\u8ee2\u3059\u308b\u89d2\u5ea6\u304c90\u3088\u308a\u5c0f\u3055\u3044\u5834\u5408 *\/\r\n    if( angle &lt; 90 ){\r\n        lPulseWidth = ( 90 - angle ) * 10;\r\n        lPulseWidth = SG_NEUTRAL - lPulseWidth;\r\n    \/* \u56de\u8ee2\u3059\u308b\u89d2\u5ea6\u304c90\u3088\u308a\u5927\u304d\u304f180\u4ee5\u4e0b\u306e\u5834\u5408 *\/\r\n    } else if ( angle &lt;= 180 ){\r\n        lPulseWidth = ( angle - 90 ) * 10;\r\n        lPulseWidth = SG_NEUTRAL + lPulseWidth;\r\n    \/* \u4e0a\u8a18\u4ee5\u5916\u306f\u30a8\u30e9\u30fc *\/\r\n    } else {\r\n        return -1;\r\n    }\r\n    \/* \u30dd\u30fc\u30c8\u306b\u6d41\u3059\u30d1\u30eb\u30b9\u306e\u6642\u9593\u3092\u8a2d\u5b9a\u3059\u308b *\/\r\n    pulsewidth_us( lPulseWidth );\r\n    return 0;\r\n}<\/pre>\n<p>\u3053\u306e\u30af\u30e9\u30b9\u3092\u5229\u7528\u3059\u308b\u7b87\u6240\u306e\u5b9f\u88c5\u306f\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3002<\/p>\n<pre class=\"lang:default highlight:0 decode:true \">#include \"mbed.h\"\r\n#include \"ServoSg90.h\"\r\n\/* \u5f15\u6570\u306b\u4f7f\u7528\u3059\u308b\u30c7\u30fc\u30bf\u7dda\u306e\u756a\u53f7\u3092\u6307\u5b9a\u5ba3\u8a00\u3059\u308b *\/\r\nServoSg90  servo0(D2);\r\n\/**\r\n * \u30e1\u30a4\u30f3\u51e6\u7406\r\n *\/\r\nint main()\r\n{\r\n    \/* init servo *\/\r\n    servo0.init();\r\n\u30fb\u30fb\u30fb\r\n    \/* roll servo *\/\r\n    servo0.roll(80);\r\n    servo0.roll(120);\r\n\u30fb\u30fb\u30fb\r\n}\r\n<\/pre>\n<p>&nbsp;<\/p>\n<h2><strong>\u52d5\u4f5c\u78ba\u8a8d\u7d50\u679c<\/strong><\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5962\" src=\"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2019\/03\/no5_03.png\" alt=\"\" width=\"385\" height=\"359\" srcset=\"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2019\/03\/no5_03.png 385w, https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2019\/03\/no5_03-300x280.png 300w\" sizes=\"auto, (max-width: 385px) 100vw, 385px\" \/> <img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5963\" src=\"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2019\/03\/no5_04.png\" alt=\"\" width=\"374\" height=\"411\" srcset=\"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2019\/03\/no5_04.png 374w, https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-content\/uploads\/2019\/03\/no5_04-273x300.png 273w\" sizes=\"auto, (max-width: 374px) 100vw, 374px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>\u554f\u984c\u306a\u304f\u5236\u5fa1\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>\u4eca\u56de\u4f5c\u6210\u3057\u305f\u30af\u30e9\u30b9\u3092\u4f7f\u3048\u3070\u3001\u30b5\u30fc\u30dc\u30e2\u30fc\u30bf\u304c\u8907\u6570\u500b\u306b\u306a\u3063\u305f\u5834\u5408\u3001\u305d\u306e\u5206\u30af\u30e9\u30b9\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u751f\u6210\u3057\u3066\u304a\u3051\u3070\u3001\u500b\u3005\u3067\u5236\u5fa1\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<p>\u3053\u306e\u30b5\u30fc\u30dc\u30e2\u30fc\u30bf\u3092\u4f7f\u3063\u3066\u3001\u3069\u306e\u69d8\u306a\u95a2\u7bc0\u3092\u69cb\u6210\u3059\u308b\u304c\u8ab2\u984c\u3068\u3057\u3066\u6b8b\u308a\u307e\u3059\u304c\u3001<\/p>\n<p>\u305d\u308c\u306f\u307e\u305f\u5225\u306e\u6a5f\u4f1a\u306b\u304a\u8a71\u3057\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u4ee5\u4e0a\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30e2\u30fc\u30bf\u5236\u5fa1\u3057\u3066\u307f\u308b &nbsp; \u306f\u3058\u3081\u306b \u4eca\u56de\u306f\u30ed\u30dc\u30c3\u30c8\u306e\u95a2\u7bc0\u3067\u4f7f\u7528\u3059\u308b\u30e2\u30fc\u30bf\u306e\u5236\u5fa1\u306b\u3064\u3044\u3066\u8a18\u8f09\u3057\u3066\u3044\u304d\u307e\u3059\u3002 \u30e2\u30fc\u30bf\u3068\u3044\u3063\u3066\u3082\u3001\u69d8\u3005\u306a\u7a2e\u985e\u306e\u30e2\u30fc\u30bf\u304c\u3042\u308a\u307e\u3059\u3002 \u30ed\u30dc\u30c3\u30c8\u306e\u95a2\u7bc0\u3092\u5236\u5fa1\u3059\u308b\u3068\u3044\u3046\u89b3\u70b9\u3067\u7740\u76ee\u3059\u308b\u3068\u3001\u7279\u5b9a\u306e\u89d2 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":5960,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"vkexunit_cta_each_option":"","footnotes":""},"categories":[106,6],"tags":[],"class_list":["post-5957","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-106","category-engineer"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/posts\/5957","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/comments?post=5957"}],"version-history":[{"count":4,"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/posts\/5957\/revisions"}],"predecessor-version":[{"id":5965,"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/posts\/5957\/revisions\/5965"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/media\/5960"}],"wp:attachment":[{"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/media?parent=5957"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/categories?post=5957"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ois-yokohama.co.jp\/oisblog2018\/wp-json\/wp\/v2\/tags?post=5957"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}