{"id":29699,"date":"2015-05-26T14:59:31","date_gmt":"2015-05-26T21:59:31","guid":{"rendered":"https:\/\/blog.btrax.com\/jp\/?p=29699"},"modified":"2020-08-10T11:27:52","modified_gmt":"2020-08-10T02:27:52","slug":"iot-smartdiscoball","status":"publish","type":"post","link":"https:\/\/blog.btrax.com\/jp\/iot-smartdiscoball\/","title":{"rendered":"\u3010IoT\u958b\u767a\u30d6\u30ed\u30b0\u3011\u4e16\u754c\u521d?\u30b9\u30de\u30fc\u30c8\u30a6\u30a9\u30c3\u30c1\u304b\u3089\u58f0\u3067\u56de\u305b\u308b\u30b9\u30de\u30fc\u30c8\u30df\u30e9\u30fc\u30dc\u30fc\u30eb\u306e\u958b\u767a"},"content":{"rendered":"<div class='wp_content_tag clearfix'><p><a href=\"https:\/\/btrax.com\/\" target=\"_balnk\">btrax<\/a>\u306f\u3001\u30a4\u30ce\u30d9\u30fc\u30b7\u30e7\u30f3\u306e\u6700\u5148\u7aef\u3092\u884c\u304f\u672c\u5834\u30b5\u30f3\u30d5\u30e9\u30f3\u30b7\u30b9\u30b3\u30fb\u30b7\u30ea\u30b3\u30f3\u30d0\u30ec\u30fc\u3067<strong>\u77ed\u671f\u96c6\u4e2d\u5c11\u6570\u7cbe\u92ed\u3067\u30a4\u30ce\u30d9\u30fc\u30b7\u30e7\u30f3\u5275\u51fa\u306b\u30c1\u30e3\u30ec\u30f3\u30b8\u3067\u304d\u308b<a href=\"https:\/\/blog.btrax.com\/jp\/innovation-program\/\">\u300c\u30a4\u30ce\u30d9\u30fc\u30b7\u30e7\u30f3 \u30d7\u30ed\u30b0\u30e9\u30e0\u300d<\/a><\/strong>\u3092\u63d0\u4f9b\u3057\u3066\u3044\u308b\u3002<\/p>\n<p>\u307e\u305f\u3001\u30e2\u30d0\u30a4\u30eb\u30a2\u30d7\u30ea\u3084Web\u30b5\u30fc\u30d3\u30b9\u3060\u3051\u3067\u306a\u304f\u3001IoT\u30c7\u30d0\u30a4\u30b9\u306e\u5e02\u5834\u8abf\u67fb\u3084UX\u7814\u7a76\u306f\u3082\u3061\u308d\u3093\u3001\u793e\u5185\u3067\u306f\u6df1\u3044\u77e5\u898b\u3092\u5f97\u308b\u305f\u3081\u306b\u3001IoT\u30d7\u30ed\u30c8\u30bf\u30a4\u30d7\u3092\u958b\u767a\u3059\u308b\u3053\u3068\u3067\u3001\u3088\u308a\u826f\u3044\u30b5\u30fc\u30d3\u30b9\u3092\u63d0\u4f9b\u3067\u304d\u308b\u3088\u3046\u306b\u52aa\u3081\u3066\u3044\u308b\u3002<\/p>\n<p>\u4eca\u56de\u306f\u793e\u5185\u30a8\u30f3\u30b8\u30cb\u30a2\u304c\u3001IoT\u306e\u7814\u7a76\u306e\u4e00\u74b0\u3068\u3057\u3066\u3001\u5f0a\u793e\u30b5\u30f3\u30d5\u30e9\u30f3\u30b7\u30b9\u30b3\u306e\u30aa\u30d5\u30a3\u30b9\u306b\u53d6\u308a\u4ed8\u3051\u3089\u308c\u305f\u30df\u30e9\u30fc\u30dc\u30fc\u30eb\u3092\u30b9\u30de\u30fc\u30c8\u30a6\u30a9\u30c3\u30c1\u304b\u3089\u58f0\u3067\u64cd\u4f5c\u3059\u308b\u30d7\u30ed\u30c8\u30bf\u30a4\u30d7\u3092\u958b\u767a\u3057\u305f\u3002\u958b\u767a\u65b9\u6cd5\u3092\u3054\u7d39\u4ecb\u3057\u3088\u3046\u3002<\/p>\n<p><div class=\"wrap_iframe ytbe\"><iframe loading=\"lazy\" title=\"Connected disco ball\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/Vr0q5PxDKMc?feature=oembed\"  allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p><\/div>\n<p>\u30df\u30e9\u30fc\u30dc\u30fc\u30eb\u306f\u30de\u30a4\u30af\u30ed\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u306eRaspberry Pi\u3092\u901a\u3057\u3066\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u306b\u3064\u306a\u304c\u3063\u3066\u304a\u308a\u3001<strong>\u30b9\u30de\u30fc\u30c8\u30a6\u30a9\u30c3\u30c1\u304b\u3089\u6b21\u306e\u97f3\u58f0\u3067\u64cd\u4f5c\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3002<\/strong> \u306a\u304a\u3001\u901f\u5ea6\u306f\u3001\u30b9\u30de\u30fc\u30c8\u30a6\u30a9\u30c3\u30c1\u306e\u753b\u9762\u4e0a\u306e\u30b9\u30e9\u30a4\u30c0\u30fc\u304b\u3089\u3082\u64cd\u4f5c\u53ef\u80fd\u3002<\/p>\n<ul>\n<li>Speed up : \u56de\u8ee2\u304c\u901f\u304f\u306a\u308b<\/li>\n<li>Speed down : \u56de\u8ee2\u304c\u9045\u304f\u306a\u308b<\/li>\n<\/ul>\n<h2>1. \u7528\u610f\u3059\u308b\u3082\u306e<\/h2>\n<h3>1-1. Android Wear\u3092\u642d\u8f09\u3057\u305f\u30b9\u30de\u30fc\u30c8\u30a6\u30a9\u30c3\u30c1<\/h3>\n<p>btrax\u3067\u306f\u3001\u3059\u3067\u306bAndroid\u306e\u30b9\u30de\u30fc\u30c8\u30a6\u30a9\u30c3\u30c1\u7528OS\u300cAndroid Wear\u300d\u3092\u7528\u3044\u305f\u30b9\u30de\u30fc\u30c8\u30a6\u30a9\u30c3\u30c1\u7528\u30a2\u30d7\u30ea\u3001\u300c<a href=\"https:\/\/blog.btrax.com\/jp\/2015\/01\/20\/ontask\/\" target=\"_blank\" rel=\"noopener\">OnTask<\/a>\u300d\u3092\u30ea\u30ea\u30fc\u30b9\u3057\u3066\u3044\u308b\u3002\u4eca\u56de\u306f\u3001Asus\u304c2014\u5e74\u672b\u306b\u767a\u58f2\u3057\u305f\u3001Asus zenwatch\u3092\u7528\u3044\u305f\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-29738 aligncenter\" src=\"https:\/\/blog.btrax.com\/jp\/wp-content\/uploads\/sites\/3\/2015\/05\/zenwatch.png\" alt=\"zenwatch\" width=\"715\" height=\"406\" srcset=\"https:\/\/blog.btrax.com\/jp\/wp-content\/uploads\/sites\/3\/2015\/05\/zenwatch.png 715w, https:\/\/blog.btrax.com\/jp\/wp-content\/uploads\/sites\/3\/2015\/05\/zenwatch-300x170.png 300w, https:\/\/blog.btrax.com\/jp\/wp-content\/uploads\/sites\/3\/2015\/05\/zenwatch-704x400.png 704w, https:\/\/blog.btrax.com\/jp\/wp-content\/uploads\/sites\/3\/2015\/05\/zenwatch-678x385.png 678w, https:\/\/blog.btrax.com\/jp\/wp-content\/uploads\/sites\/3\/2015\/05\/zenwatch-341x194.png 341w, https:\/\/blog.btrax.com\/jp\/wp-content\/uploads\/sites\/3\/2015\/05\/zenwatch-624x354.png 624w\" sizes=\"auto, (max-width: 715px) 100vw, 715px\" \/><\/p>\n<h3>1-2. \u30df\u30e9\u30fc\u30dc\u30fc\u30eb\u7528\u306e\u30e2\u30fc\u30bf\u30fc<\/h3>\n<p>\u666e\u901a\u306e\u30e2\u30fc\u30bf\u30fc\u3067\u306f\u56de\u8ee2\u6570\u304c\u9ad8\u3059\u304e\u308b\u305f\u3081\u3001\u5e02\u8ca9\u306e\u96fb\u6c60\u5f0f\u30df\u30e9\u30fc\u30dc\u30fc\u30eb\u7528\u30e2\u30fc\u30bf\u3092\u5229\u7528\u3059\u308b\u3002\u4eca\u56de\u8cfc\u5165\u3057\u305f\u3082\u306e\u306f\u3001\u5358\uff11\u96fb\u6c60\u30921\u672c\u4f7f\u3044\u30011\u5206\u9593\u306b2\u56de\u8ee2\u3068\u975e\u5e38\u306b\u3086\u3063\u304f\u308a\u56de\u308b\u30e2\u30fc\u30bf\u3060\u3002\u8cfc\u5165\u3057\u305f\u72b6\u614b\u3067\u306fON\u3068OFF\u3057\u304b\u3067\u304d\u306a\u3044\u304c\u3001Rasbperry Pi\u3067\u56de\u8ee2\u901f\u5ea6\u3092\u8abf\u6574\u3067\u304d\u308b\u3088\u3046\u306b\u6539\u9020\u3057\u305f\u3002<\/p>\n<h3>1-3. Raspberry Pi<\/h3>\n<p>Raspberry Pi(\u30e9\u30ba\u30d9\u30ea\u30fc\u30d1\u30a4)\u306fARM\u30d7\u30ed\u30bb\u30c3\u30b5\u3092\u642d\u8f09\u3057\u305f\u30b7\u30f3\u30b0\u30eb\u30dc\u30fc\u30c9\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u3067\u3042\u308b\u30022015\u5e742\u6708\u306b\u6700\u65b0\u306e\u300cRaspberry Pi2\u300d\u304c\u767a\u58f2\u3055\u308c\u305f\u3002\u4fa1\u683c\u306f\u306a\u3093\u30685,000\u5186\u672a\u6e80\u3002<\/p>\n<p>\u5927\u304d\u3055\u306f\u540d\u523a\u30b5\u30a4\u30ba\u3067\u3001\u91cd\u3055\u306f\u308f\u305a\u304b45g\u3002\u3057\u304b\u3057\u3001\u305d\u306e\u5b9f\u614b\u306f\u9ad8\u6027\u80fd\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u3060\u3002\u307e\u305a\u4ee3\u8868\u7684\u306aOS\u3067\u3042\u308bLinux\u3092\u642d\u8f09\u3067\u304d\u308b\u3002\u80fd\u529b\u304c\u9ad8\u3044\u305f\u3081\u3001\u5358\u4f53\u3067\u7c21\u5358\u306a\u753b\u50cf\u8a8d\u8b58\u51e6\u7406\u3082\u884c\u3046\u3053\u3068\u3082\u3067\u304d\u308b\u3002<\/p>\n<h3>1-4. \u30e2\u30fc\u30bf\u30c9\u30e9\u30a4\u30d0<\/h3>\n<p>\u30e2\u30fc\u30bf\u306e\u5236\u5fa1\u306b\u306fI2C\u5bfe\u5fdc\u306e\u30e2\u30fc\u30bf\u30c9\u30e9\u30a4\u30d0\u3092\u7528\u3044\u305f\u3002\u4eca\u56de\u306f\u3001\u624b\u5143\u306b\u3042\u3063\u305f\u79cb\u6708\u96fb\u5b50\u901a\u5546\u306e<a href=\"https:\/\/akizukidenshi.com\/catalog\/g\/gK-06489\/\" target=\"_blank\" rel=\"noopener\">DRV8830\u4f7f\u7528 DC\u30e2\u30fc\u30bf\u30fc\u30c9\u30e9\u30a4\u30d6\u30ad\u30c3\u30c8<\/a>\u3092\u4f7f\u7528\u3057\u3066\u3044\u308b\u3002I2C\u5bfe\u5fdc\u306e\u305f\u3081\u3001\u56de\u8def\u306f\u975e\u5e38\u306b\u7c21\u5358\u306b\u306a\u308a\u3001Raspberry Pi\u3068\u30e2\u30fc\u30bf\u30c9\u30e9\u30a4\u30d0\u30ad\u30c3\u30c8\u306e\u9593\u30923\u672c\u306e\u7dda\u3067\u7e4b\u3050\u3060\u3051\u3067\u3088\u3044\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-29785 aligncenter\" src=\"https:\/\/blog.btrax.com\/jp\/wp-content\/uploads\/sites\/3\/2015\/05\/devices.jpg\" alt=\"devices\" width=\"715\" height=\"402\" srcset=\"https:\/\/blog.btrax.com\/jp\/wp-content\/uploads\/sites\/3\/2015\/05\/devices.jpg 715w, https:\/\/blog.btrax.com\/jp\/wp-content\/uploads\/sites\/3\/2015\/05\/devices-300x169.jpg 300w, https:\/\/blog.btrax.com\/jp\/wp-content\/uploads\/sites\/3\/2015\/05\/devices-704x396.jpg 704w, https:\/\/blog.btrax.com\/jp\/wp-content\/uploads\/sites\/3\/2015\/05\/devices-685x385.jpg 685w, https:\/\/blog.btrax.com\/jp\/wp-content\/uploads\/sites\/3\/2015\/05\/devices-341x192.jpg 341w, https:\/\/blog.btrax.com\/jp\/wp-content\/uploads\/sites\/3\/2015\/05\/devices-624x351.jpg 624w\" sizes=\"auto, (max-width: 715px) 100vw, 715px\" \/><br \/>\n<em>Raspberry Pi(\u624b\u524d)\u3068\u30e2\u30fc\u30bf\u30c9\u30e9\u30a4\u30d0\u30ad\u30c3\u30c8(\u5965)\u3002\u30af\u30ea\u30c3\u30d7\u306e\u5148\u306b\u30e2\u30fc\u30bf\u3092\u53d6\u308a\u4ed8\u3051\u308b\u3002\u53f3\u306b\u5207\u308c\u3066\u3044\u308b\u8d64\u3068\u9ed2\u306e\u7dda\u306f\u96fb\u6e90\u7528<\/em><\/p>\n<h2>2. Raspberry Pi\u306e\u958b\u767a<\/h2>\n<p>\u4eca\u56de\u306f\u3001Raspberry Pi\u306b\u30e2\u30fc\u30bf\u30c9\u30e9\u30a4\u30d0\u3092\u53d6\u308a\u4ed8\u3051\u3001\u305d\u306e\u5148\u306b\u30df\u30e9\u30fc\u30dc\u30fc\u30eb\u7528\u306e\u30e2\u30fc\u30bf\u3092\u53d6\u308a\u4ed8\u3051\u308b\u3068\u3044\u3046\u30b7\u30f3\u30d7\u30eb\u306a\u69cb\u6210\u3068\u3059\u308b\u3002\u306a\u304a\u3001Raspbery Pi2\u3092\u5229\u7528\u3057\u3066\u304a\u308a\u3001\u30d5\u30a1\u30fc\u30e0\u30a6\u30a7\u30a2\u306e\u60c5\u5831\u306f\u6b21\u306e\u901a\u308a\u3067\u3042\u308b\u3002<\/p>\n<p>[code]<br \/>\n$ uname -a<br \/>\nLinux raspberrypi 3.18.10-v7+ #775 SMP PREEMPT Thu Apr 2 19:01:29 BST 2015 armv7l GNU\/Linux<br \/>\n$ cat \/etc\/debian_version<br \/>\n7.8<br \/>\n[\/code]<\/p>\n<h3>2-1. \u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e<\/h3>\n<p>\u4eca\u56de\u306f\u3001I2C\u901a\u4fe1\u3092\u884c\u3046\u3053\u3068\u3068\u5c06\u6765\u7684\u306b\u30ab\u30e1\u30e9\u306a\u3069\u3092\u4f7f\u3046\u3053\u3068\u3092\u60f3\u5b9a\u3057\u3066\u3044\u308b\u3002\u3053\u306e\u305f\u3081\u3001Raspberry Pi\u3068\u306e\u76f8\u6027\u304c\u3088\u3044Python\u3068\u3044\u3046\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u3092\u4f7f\u3046\u3002Python\u3092\u4f7f\u3063\u3066\u3044\u308b\u8aad\u8005\u306f\u5c11\u306a\u3044\u304b\u3082\u3057\u308c\u306a\u3044\u304c\u3001\u4eca\u56de\u306f\u975e\u5e38\u306b\u7c21\u5358\u306a\u30b3\u30fc\u30c9\u3057\u304b\u66f8\u304b\u306a\u3044\u306e\u3067\u7406\u89e3\u3067\u304d\u308b\u3068\u601d\u3046\u3002Python\u306f\u3001Raspberry Pi\u3067\u6a19\u6e96\u3067\u7528\u610f\u3055\u308c\u3066\u304a\u308a\u3001\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3053\u3068\u306a\u304f\u4f7f\u3048\u308b\u3002<\/p>\n<p>\u524d\u56de\u306f\u3001<a href=\"https:\/\/blog.btrax.com\/jp\/iot-dev\/\" target=\"_blank\" rel=\"noopener\">\u3010IoT\u958b\u767a\u30d6\u30ed\u30b0\u3011Raspberry Pi + Node.js + PubNub(mBaaS)\u3067\u3001\u30d6\u30e9\u30a6\u30b6\u3068IoT\u306e\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u901a\u4fe1\u3092\u5b9f\u88c5<\/a>\u3067\u3001Node.js\u3092\u5229\u7528\u3057\u305f\u3002Node.js\u306e\u307b\u3046\u304c\u7d4c\u9a13\u304c\u3042\u308bWeb\u30a8\u30f3\u30b8\u30cb\u30a2\u304c\u591a\u3044\u3068\u601d\u308f\u308c\u305f\u305f\u3081\u3060\u3002\u305f\u3060\u3001\u30ab\u30e1\u30e9\u3084I2C\u3001GPIO\u306a\u3069\u306eRaspberry Pi\u306e\u30cf\u30fc\u30c9\u30a6\u30a7\u30a2\u306e\u6a5f\u80fd\u3092\u4f7f\u3063\u3066\u3044\u304f\u969b\u306b\u306f\u3001Python\u306e\u65b9\u304c\u6271\u3044\u3084\u3059\u3044\u5834\u5408\u304c\u591a\u304f\u3042\u308b\u3002\u306a\u304a\u3001\u4eca\u56de\u5229\u7528\u3057\u305f\u306e\u306fPython2.x\u3067\u3042\u308b\u3002<\/p>\n<p>[code]<br \/>\n$ python &#8211;version<br \/>\nPython 2.7.3<br \/>\n[\/code]<\/p>\n<h3>2-2. \u30e2\u30fc\u30bf\u30fc\u5236\u5fa1\u306bI2C\u3092\u4f7f\u3046<\/h3>\n<p>\u30e2\u30fc\u30bf\u30fc\u306e\u5236\u5fa1\u306b\u306fI2C\u5bfe\u5fdc\u306eIC\u3092\u4f7f\u3046\u3002I2C\uff08\u30a2\u30a4\u30fb\u30b9\u30af\u30a8\u30a2\u30fb\u30b7\u30fc\u3001\u30a2\u30a4\u30fb\u30c4\u30fc\u30fb\u30b7\u30fc\uff09\u306f\u30d5\u30a3\u30ea\u30c3\u30d7\u30b9\u793e\u3067\u958b\u767a\u3055\u308c\u305f\u30b7\u30ea\u30a2\u30eb\u30d0\u30b9\u3067\u3042\u308a\u3001\u4f4e\u901f\u306a\u5468\u8fba\u6a5f\u5668\u3092\u30de\u30b6\u30fc\u30dc\u30fc\u30c9\u3078\u63a5\u7d9a\u3057\u305f\u308a\u7d44\u307f\u8fbc\u307f\u30b7\u30b9\u30c6\u30e0\u3001\u643a\u5e2f\u96fb\u8a71\u306a\u3069\u3067\u4f7f\u308f\u308c\u3066\u3044\u308b\u3002<\/p>\n<p>I2C\u3092\u4f7f\u3046\u3068IC\u30c1\u30c3\u30d7\u9593\u3067\u30b7\u30ea\u30a2\u30eb\u901a\u4fe1\u306b\u3088\u308a\u30c7\u30fc\u30bf\u3092\u3084\u308a\u53d6\u308a\u304c\u3067\u304d\u308b\u305f\u3081\u3001\u5358\u7d14\u306aON\u3068OFF\u3057\u304b\u306a\u3044\u4ed6\u306eI\/O\u3088\u308a\u3082\u9ad8\u6a5f\u80fd\u3067\u5229\u4fbf\u6027\u304c\u9ad8\u3044\u3002I2C\u3092\u7528\u3044\u305f\u6e29\u5ea6\u8a08\u306a\u3069\u3001\u69d8\u3005\u306a\u30bb\u30f3\u30b5\u30fc\u304c\u5b58\u5728\u3059\u308b\u305f\u3081\u3001I2C\u306e\u4f7f\u3044\u65b9\u3092\u30de\u30b9\u30bf\u30fc\u3057\u3066\u304a\u304f\u3068\u3067\u304d\u308b\u3053\u3068\u3082\u5927\u304d\u304f\u5e83\u304c\u308b\u3002<\/p>\n<p>\u7279\u306b\u3001<strong>\u96fb\u5b50\u56de\u8def\u306e\u77e5\u8b58\u304c\u4e4f\u3057\u3044Web\u3084\u30a2\u30d7\u30ea\u306e\u30c7\u30a3\u30d9\u30ed\u30c3\u30d1\u30fc\u306b\u3068\u3063\u3066\u306f\u3001\u96fb\u5b50\u56de\u8def\u306e\u69cb\u7bc9\u304c\u697d\u306b\u306a\u308b\u30e1\u30ea\u30c3\u30c8\u306f\u5927\u304d\u3044\u3002<\/strong><\/p>\n<h3>2-3. Raspbery Pi\u306eI2C\u306e\u8a2d\u5b9a<\/h3>\n<p>\u307e\u305a\u3001Raspberry Pi\u672c\u4f53\u306eI2C\u306e\u8a2d\u5b9a\u3092\u6709\u52b9\u306b\u3059\u308b\u3002\u3053\u306e\u65b9\u6cd5\u306b\u3064\u3044\u3066\u306f\u3001\u3044\u304f\u3064\u3082\u512a\u308c\u305f\u8a18\u4e8b\u304c\u3042\u308b\u305f\u3081\u3001\u5225\u306e\u30b5\u30a4\u30c8\u3092\u53c2\u8003\u306b\u3057\u3066\u3044\u305f\u3060\u304d\u305f\u3044\u3002\u5f0a\u793e\u3067\u306f\u6b21\u306e\u8a18\u4e8b\u3092\u53c2\u8003\u306b\u3055\u305b\u3066\u3044\u305f\u3060\u3044\u305f\u3002<\/p>\n<p>2015\u5e741\u6708\u306e\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u304b\u3089I2C\u306e\u6709\u52b9\u5316\u306e\u65b9\u6cd5\u304c\u5909\u308f\u3063\u3066\u3044\u308b\u305f\u3081\u3001\u691c\u7d22\u3059\u308b\u3068\u53e4\u3044\u65b9\u6cd5\u3067\u89e3\u8aac\u3055\u308c\u3066\u3044\u308b\u30da\u30fc\u30b8\u304c\u898b\u3064\u304b\u308b\u3053\u3068\u304c\u591a\u3044\u306e\u3067\u6c17\u3092\u3064\u3051\u3066\u307b\u3057\u3044\u3002<\/p>\n<p>I2C\u8a2d\u5b9a\u65b9\u6cd5\uff1a<a href=\"https:\/\/blog.ymyzk.com\/2015\/02\/enable-raspberry-pi-i2c\/\" target=\"_blank\" rel=\"noopener\">Raspberry Pi \u306e I2C \u3092\u6709\u52b9\u5316\u3059\u308b\u65b9\u6cd5 (2015\u5e74\u7248)<\/a><\/p>\n<p>I2C\u3092\u6709\u52b9\u306b\u8a2d\u5b9a\u3057\u305f\u5f8c\u3001\u30e2\u30fc\u30bf\u30c9\u30e9\u30a4\u30d0\u3092\u63a5\u7d9a\u3057\u3001\u6b21\u306e\u30b3\u30de\u30f3\u30c9\u3067\u63a5\u7d9a\u3055\u308c\u3066\u3044\u308b\u304b\u3092\u78ba\u8a8d\u3059\u308b\u3002\u6b21\u306e\u30b3\u30de\u30f3\u30c9\u3067\u3001\u4eca\u56de\u306e\u30e2\u30fc\u30bf\u30c9\u30e9\u30a4\u30d0\u306e\u30a2\u30c9\u30ec\u30b9\u3092\u8abf\u3079\u308b\u3002<\/p>\n<p>[code]<br \/>\n$ sudo i2cdetect -y 1<br \/>\n     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f<br \/>\n00:          &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212;<br \/>\n10: &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212;<br \/>\n20: &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212;<br \/>\n30: &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212;<br \/>\n40: &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212;<br \/>\n50: &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212;<br \/>\n60: &#8212; &#8212; &#8212; &#8212; 64 &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212;<br \/>\n70: &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212; &#8212;<br \/>\n[\/code]<\/p>\n<p>0x64\u304c\u3001\u30e2\u30fc\u30bf\u30c9\u30e9\u30a4\u30d0\u306e\u30a2\u30c9\u30ec\u30b9\u3067\u3042\u308b\u3002\u3053\u306e\u30a2\u30c9\u30ec\u30b9\u3092\u30d7\u30ed\u30b0\u30e9\u30e0\u304b\u3089\u6307\u5b9a\u3057\u3066\u3001\u30e2\u30fc\u30bf\u30c9\u30e9\u30a4\u30d0\u3092\u64cd\u4f5c\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3002<\/p>\n<h3>2-4. \u30e2\u30fc\u30bf\u30c9\u30e9\u30a4\u30d0\u306e\u4f7f\u3044\u65b9<\/h3>\n<p>\u3053\u3053\u3067\u3001\u5229\u7528\u3059\u308b\u30e2\u30fc\u30bf\u30c9\u30e9\u30a4\u30d0DRV8830\u306e\u4f7f\u3044\u65b9\u3092\u898b\u3066\u307f\u3088\u3046\u3002\u975e\u5e38\u306b\u4fbf\u5229\u306b\u3067\u304d\u3066\u304a\u308a\u3001\u30e2\u30fc\u30bf\u30c9\u30e9\u30a4\u30d0\u306b8\u30d3\u30c3\u30c8\u306e\u60c5\u5831\u3092\u66f8\u304d\u8fbc\u3080\u3053\u3068\u3067\u3001\u30e2\u30fc\u30bf\u306b\u4f9b\u7d66\u3055\u308c\u308b\u96fb\u5727\u3068\u3001\u72b6\u614b\u3092\u5909\u66f4\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3002\u96fb\u5727\u304c\u5909\u308f\u308c\u3070\u30e2\u30fc\u30bf\u306e\u901f\u5ea6\u304c\u5909\u308f\u308b\u3002\u3053\u306e\u305f\u3081\u3001\u975e\u5e38\u306b\u7c21\u5358\u306a\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u901f\u5ea6\u3092\u5909\u5316\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3002\u307e\u305f\u3001\u4eca\u56de\u306f\u89e6\u308c\u306a\u3044\u304c\u3001\u73fe\u5728\u306e\u96fb\u5727\u306e\u53d6\u5f97\u3082\u3067\u304d\u308b\u3002<\/p>\n<p>\u30e2\u30fc\u30bf\u30c9\u30e9\u30a4\u30d0\u306e<a href=\"https:\/\/www.ti.com\/lit\/ds\/symlink\/drv8830.pdf\" target=\"_blank\" rel=\"noopener\">\u30c7\u30fc\u30bf\u30b7\u30fc\u30c8<\/a>\u3092\u898b\u308b\u3068\u3001\u53f3\u304b\u30892\u6841\u304c\u3001\u52d5\u4f5c\u7528\u3068\u3057\u3066\u4f7f\u308f\u308c\u308b\u3053\u3068\u304c\u308f\u304b\u308b\u3002<\/p>\n<ul>\n<li>00 : \u30b9\u30bf\u30f3\u30d0\u30a4\/\u60f0\u8d70<\/li>\n<li>01 : \u9006\u8ee2<\/li>\n<li>10 : \u6b63\u8ee2<\/li>\n<li>11 : \u30d6\u30ec\u30fc\u30ad<\/li>\n<\/ul>\n<p>\u307e\u305f\u3001\u540c\u69d8\u306b\u53f3\u304b\u30893\u6841\u76ee\u4ee5\u964d\u306e6\u6841\u304c\u96fb\u5727\u3092\u8868\u3059\u30020x6(000110)\u304b\u30890x3F(111111)\u307e\u3067\u306e\u5024\u3092\u6307\u5b9a\u3059\u308b\u3002\u4f8b\u3048\u3070\u30011.53V\u306e\u96fb\u5727\u3067\u3001\u6b63\u8ee2\u3055\u305b\u305f\u3044\u3068\u304d\u306f\u3001\u901f\u5ea60x13(10011)\u306b\u3001\u52d5\u4f5c\u7528\u306e01\u3092\u52a0\u3048\u3066\u30011001101\u3092\u66f8\u304d\u8fbc\u3080\u3002<\/p>\n<h3>2-5. Raspberry Pi\u306e\u30d7\u30ed\u30b0\u30e9\u30e0<\/h3>\n<p>\u4eca\u56de\u3082\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u901a\u4fe1\u304c\u53ef\u80fd\u306amBaaS(Mobile Backend as a service)\u3067\u3042\u308b\u3001<a href=\"https:\/\/www.pubnub.com\/\" target=\"_blank\" rel=\"noopener\">PubNub<\/a>\u3092\u4f7f\u3046\u3002Raspberry Pi\u306e\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3068PubNub\u306b\u3064\u3044\u3066\u8a73\u3057\u304f\u306f\u3001<a href=\"https:\/\/blog.btrax.com\/jp\/2015\/04\/12\/iot-dev\/\" target=\"_blank\" rel=\"noopener\">\u3010IoT\u958b\u767a\u30d6\u30ed\u30b0\u3011Raspberry Pi + Node.js + PubNub(mBaaS)\u3067\u3001\u30d6\u30e9\u30a6\u30b6\u3068IoT\u306e\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u901a\u4fe1\u3092\u5b9f\u88c5<\/a>\u3092\u3054\u89a7\u3044\u305f\u3060\u304d\u305f\u3044\u3002<\/p>\n<p>python\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u7ba1\u7406\u30b7\u30b9\u30c6\u30e0\u3067\u3042\u308b\u3001pip\u3092\u4f7f\u3044pubnub\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3002<\/p>\n<p>[code]<br \/>\n$ pip install pubnub<br \/>\n[\/code]<\/p>\n<p>\u306a\u304a\u3001pip\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u306a\u3044\u5834\u5408\u306f<a href=\"https:\/\/www.raspberrypi.org\/documentation\/linux\/software\/python.md\" target=\"_blank\" rel=\"noopener\">INSTALLING PYTHON PACKAGES|Raspberry Pi\u516c\u5f0f\u30b5\u30a4\u30c8<\/a>\u3092\u53c2\u8003\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u307b\u3057\u3044\u3002<\/p>\n<p>PubNub\u3078\u306e\u63a5\u7d9a\u306f\u3044\u305f\u3063\u3066\u7c21\u5358\u3067\u3001subscribe\u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3076\u3068\u3001\u30b9\u30de\u30fc\u30c8\u30d5\u30a9\u30f3\u3084\u4ed6\u306e\u30c7\u30d0\u30a4\u30b9\u304c\u8a2d\u5b9a\u3057\u305f\u30c1\u30e3\u30f3\u30cd\u30eb\u306bPUSH\u3055\u308c\u305f\u3068\u304d\u306b\u3001subscribeCallback\u304c\u547c\u3070\u308c\u308b\u3002subscribeCallback\u5185\u3067\u3001\u30e2\u30fc\u30bf\u306e\u96fb\u5727\u3092\u5909\u5316\u3055\u305b\u308b\u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3079\u3070\u3088\u3044\u3002<\/p>\n<p>\u30e2\u30fc\u30bf\u304c\u4e7e\u96fb\u6c601\u672c\u7528(1.5V)\u306a\u306e\u3067\u3001\u3042\u307e\u308a\u9ad8\u3044\u96fb\u5727\u3092\u52a0\u3048\u308b\u3068\u58ca\u308c\u308b\u53ef\u80fd\u6027\u304c\u3042\u308b\u3002\u307e\u305f\u3001\u96fb\u5727\u304c\u4f4e\u3059\u304e\u308b\u3068\u56de\u8ee2\u3057\u306a\u3044\u3002<\/p>\n<p>\u305d\u3053\u3067\u3001<strong>0.64V\u304b\u3089\u30013.53V<\/strong>\u306e\u9593\u307e\u3067\u306e\u96fb\u5727\u3092\u5909\u5316\u3055\u305b\u308b\u3053\u3068\u3067\u3001\u30e2\u30fc\u30bf\u30fc\u306e\u901f\u5ea6\u3092\u5909\u66f4\u3055\u305b\u308b\u3002(\u6700\u5927\u96fb\u5727\u3092\u9ad8\u3081\u306b\u8a2d\u5b9a\u3057\u3066\u3044\u308b\u304c\u3001\u52d5\u4f5c\u3092\u4fdd\u8a3c\u3057\u3066\u3044\u308b\u308f\u3051\u3067\u306f\u306a\u3044\u306e\u3067\u3001\u3042\u304f\u307e\u3067\u81ea\u5df1\u8cac\u4efb\u3067\u304a\u9858\u3044\u3057\u305f\u3044\u3002)<\/p>\n<p>\u901f\u5ea6\u3092100\u6bb5\u968e\u3067\u6307\u5b9a\u3059\u308b\u3068\u3001\u5148\u307b\u3069\u8aac\u660e\u3057\u305f\u901a\u308a6\u30d3\u30c3\u30c8\u306e\u901f\u5ea6\u306e\u30c7\u30fc\u30bf\u3092\u751f\u6210\u3057\u3001\u305d\u308c\u306b\u6b63\u8ee2\u306e\u52d5\u4f5c\u3092\u52a0\u3048\u3066\u3001\u30e2\u30fc\u30bf\u30c9\u30e9\u30a4\u30d0\u306b\u66f8\u304d\u8fbc\u3080\u3002<\/p>\n<p>RaspberryPi\u306e\u5168\u4f53\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306f\u6b21\u306e\u3088\u3046\u306b\u306a\u308b\u3002<\/p>\n<p><strong>[Raspberry Pi] main.py<\/strong><\/p>\n<p>[python]<br \/>\n#coding:utf-8<br \/>\nimport sys<br \/>\nimport smbus<br \/>\nimport time<br \/>\nfrom Pubnub import Pubnub<\/p>\n<p>PUBLISH_KEY = &quot;&lt;Your Publish Key&gt;&quot;<br \/>\nSUBSCRIBE_KEY = &quot;&lt;Your Subscribe Key&gt;&quot;<br \/>\nCHANNEL_C_CONTROL = &quot;c-control&quot;;<br \/>\nSUBSCRIBE_CHANNELS= [CHANNEL_C_CONTROL]<br \/>\nSPEED_KEY = &#8216;speed&#8217;<br \/>\nADDRESS = 0x64<br \/>\nMIN_SPEED_BYTE = 0x08 # 0.64V<br \/>\nFAST_SPEED_BYTE = 0x2C # 3.53V<\/p>\n<p>pubnub = Pubnub(PUBLISH_KEY, SUBSCRIBE_KEY)<br \/>\ni2c = smbus.SMBus(1)<\/p>\n<p># speed 0 &#8211; 100<br \/>\ndef setSpeed(speed):<br \/>\n    if speed &gt; 100:<br \/>\n        speed = 100<br \/>\n    elif speed &lt; 0:<br \/>\n        speed = 0<\/p>\n<p>    speedByte = MIN_SPEED_BYTE + (FAST_SPEED_BYTE &#8211; MIN_SPEED_BYTE) * speed \/ 100<\/p>\n<p>    # Forward<br \/>\n    output = speedByte &lt;&lt; 2;<br \/>\n    output += 0x01<\/p>\n<p>    # write byte data to motor driver<br \/>\n    i2c.write_byte_data(ADDRESS, 0, output)<\/p>\n<p>def subscribeCallback(message, channel):<br \/>\n    print(&#8216;received, &#8216; + channel + &#8216;:&#8217; + str(message))<\/p>\n<p>    if channel == CHANNEL_C_CONTROL:<br \/>\n        speed = message[&#8216;speed&#8217;]<br \/>\n        setSpeed(speed)<\/p>\n<p>def subscribeError(message):<br \/>\n    print(str(message))<\/p>\n<p>pubnub.subscribe(SUBSCRIBE_CHANNELS, subscribeCallback, subscribeError)<br \/>\n[\/python]<\/p>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092Raspberry Pi\u5185\u3067\u5b9f\u884c\u3059\u308b\u3068\u3001Raspberry Pi\u304c\u30b9\u30de\u30fc\u30c8\u30a6\u30a9\u30c3\u30c1\u304b\u3089\u306e\u4fe1\u53f7\u3092\u5f85\u3061\u53d7\u3051\u308b\u72b6\u614b\u306b\u306a\u308b\u3002subscribe\u3057\u305f\u30c1\u30e3\u30f3\u30cd\u30eb\u306b\u3001push\u3055\u308c\u308c\u3070\u3001\u30ed\u30b0\u304c\u51fa\u529b\u3055\u308c\u3001\u30df\u30e9\u30fc\u30dc\u30fc\u30eb\u306e\u901f\u5ea6\u304c\u5909\u5316\u3059\u308b\u3002<\/p>\n<p>\u4eca\u56de\u306f\u3001Android\u306e\u30b9\u30de\u30fc\u30c8\u30a6\u30a9\u30c3\u30c1\u304b\u3089\u4fe1\u53f7\u3092\u9001\u308b\u304c\u3001Web\u30d6\u30e9\u30a6\u30b6\u3084iPhone\u3001\u4ed6\u306eRaspberry Pi\u306a\u3069\u3001\u4fe1\u53f7\u306e\u4fe1\u53f7\u5143\u306f\u306a\u3093\u3067\u3082\u3088\u3044\u3002<\/p>\n<p>[code]<br \/>\n$ sudo python main.py<br \/>\nreceived, c-control:{u&#8217;speed&#8217;: 52}<br \/>\nreceived, c-control:{u&#8217;speed&#8217;: 32}<br \/>\nreceived, c-control:{u&#8217;speed&#8217;: 75}<br \/>\nreceived, c-control:{u&#8217;speed&#8217;: 33}<br \/>\n[\/code]<\/p>\n<h2>3. \u30b9\u30de\u30fc\u30c8\u30a6\u30a9\u30c3\u30c1\u306e\u958b\u767a<\/h2>\n<p>\u3053\u3053\u304b\u3089\u306fAndroid\u306e\u958b\u767a\u306b\u3064\u3044\u3066\u89e3\u8aac\u3059\u308b\u3002\u958b\u767a\u306b\u306fAndroid Studio\u3092\u4f7f\u3046\u3002Android\u306e\u30b9\u30de\u30fc\u30c8\u30a6\u30a9\u30c3\u30c1\u958b\u767a\u306b\u3064\u3044\u3066\u306f\u3001\u904e\u53bb\u306e\u30d6\u30ed\u30b0\u300c<a href=\"https:\/\/blog.btrax.com\/jp\/2014\/12\/16\/develop-watch-face\/\" target=\"_blank\" rel=\"noopener\">\u7f8e\u5973\u6642\u8a08\u3092\u4f5c\u308d\u3046\uff01Android Wear\u958b\u767a\u5165\u9580 30\u5206\u3067\u4f5c\u308b\u76e4\u9762\u30a2\u30d7\u30ea<\/a>\u300d\u3082\u53c2\u8003\u306b\u3057\u3066\u6b32\u3057\u3044\u3002<\/p>\n<p>\u30b9\u30de\u30fc\u30c8\u30a6\u30a9\u30c3\u30c1\u304b\u3089\u76f4\u63a5\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u306b\u63a5\u7d9a\u3067\u304d\u306a\u3044\u305f\u3081\u3001\u30b9\u30de\u30fc\u30c8\u30a6\u30a9\u30c3\u30c1 &#8211;(Bluetooth)&#8211;&gt; \u30b9\u30de\u30fc\u30c8\u30d5\u30a9\u30f3 &#8211;(\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8)&#8211;&gt; PubNub &#8211;(\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8)&#8211;&gt; Raspberry Pi \u3068\u3044\u3046\u3001\u5c11\u3005\u9577\u3044\u7d4c\u8def\u3092\u901a\u3057\u3066\u30df\u30e9\u30fc\u30dc\u30fc\u30eb\u3092\u64cd\u4f5c\u3059\u308b\u3002<\/p>\n<p>\u306a\u304a\u3001Google\u306f\u30012015\u5e744\u6708\u306bApple Watch\u306e\u767a\u58f2\u3068\u307b\u307c\u540c\u3058\u30bf\u30a4\u30df\u30f3\u30b0\u3067\u3001\u6b21\u56de\u306e\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u3067\u30b9\u30de\u30fc\u30c8\u30a6\u30a9\u30c3\u30c1\u304b\u3089\u76f4\u63a5WiFi\u306b\u63a5\u7d9a\u3059\u308b\u3053\u3068\u3092\u8a31\u53ef\u3059\u308b\u3053\u3068\u3092\u30a2\u30ca\u30a6\u30f3\u30b9\u3057\u3066\u3044\u308b\u3002\u4eca\u5f8c\u306f\u3088\u308a\u30b7\u30f3\u30d7\u30eb\u306b\u30b9\u30de\u30fc\u30c8\u30a6\u30a9\u30c3\u30c1\u304b\u3089\u901a\u4fe1\u304c\u884c\u3048\u308b\u3088\u3046\u306b\u306a\u308b\u306f\u305a\u3060\u3002<\/p>\n<h3>3-1. \u30b9\u30de\u30fc\u30c8\u30a6\u30a9\u30c3\u30c1\u304b\u3089\u30b9\u30de\u30fc\u30c8\u30d5\u30a9\u30f3\u3078\u306e\u30c7\u30fc\u30bf\u9001\u4fe1<\/h3>\n<p>\u307e\u305a\u3001\u30b9\u30de\u30fc\u30c8\u30a6\u30a9\u30c3\u30c1\u304b\u3089\u30b9\u30de\u30fc\u30c8\u30d5\u30a9\u30f3\u3078\u306e\u901a\u4fe1\u3092\u884c\u3046\u3002<\/p>\n<p><strong>mobile\u3068wear\u306e\u4e21\u65b9\u306eAndroidManifest.xml<\/strong>\u306b\u3001\u4ee5\u4e0b\u306emeta-data\u3092\u8ffd\u52a0\u3059\u308b\u3002<\/p>\n<p><strong>[Wear][Mobile] AndroidManifest.xml<\/strong><\/p>\n<p>[xml]<br \/>\n&lt;meta-data<br \/>\n    android:name=&quot;com.google.android.gms.version&quot;<br \/>\n    android:value=&quot;@integer\/google_play_services_version&quot; \/&gt;<br \/>\n[\/xml]<\/p>\n<p>Wear\u306eActivity\u304b\u3089\u3001Mobile\u306b\u4fe1\u53f7\u3092\u9001\u308b\u3002\u307e\u305a\u3001GoogleApiClient\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u4f5c\u308a\u3001\u63a5\u7d9a\u3057\u3066\u304a\u304f\u3002sendSpeed\u3092\u547c\u3076\u3068\u3001\u30b9\u30de\u30fc\u30c8\u30d5\u30a9\u30f3\u306b\u60c5\u5831\u306e\u9001\u4fe1\u3092\u884c\u3046\u3002<\/p>\n<p><strong>[Wear] MainActivity.java<\/strong><\/p>\n<p>[java]<br \/>\n@Override<br \/>\nprotected void onCreate(Bundle savedInstanceState) {<br \/>\n    super.onCreate(savedInstanceState);<br \/>\n    setContentView(R.layout.activity_main);<\/p>\n<p>    &#8230;&#8230;&#8230;&#8230;(\u7701\u7565)&#8230;&#8230;&#8230;&#8230;<\/p>\n<p>    \/\/ setup comunicate with smartphone<br \/>\n    mGoogleApiClient = new GoogleApiClient.Builder(this)<br \/>\n        .addConnectionCallbacks(new GoogleApiClient.ConnectionCallbacks() {<br \/>\n            @Override<br \/>\n            public void onConnected(Bundle bundle) {<br \/>\n                Log.d(TAG, &quot;onConnected&quot;);<br \/>\n            }<br \/>\n            @Override<br \/>\n            public void onConnectionSuspended(int i) {<br \/>\n                Log.d(TAG, &quot;onConnectionSuspended&quot;);<br \/>\n            }<br \/>\n        })<br \/>\n        .addOnConnectionFailedListener(new GoogleApiClient.OnConnectionFailedListener() {<br \/>\n            @Override<br \/>\n            public void onConnectionFailed(ConnectionResult connectionResult) {<br \/>\n                Log.d(TAG, &quot;onConnectionFailed&quot;);<br \/>\n            }<br \/>\n        })<br \/>\n        .addApi(Wearable.API)<br \/>\n        .build();<\/p>\n<p>    mGoogleApiClient.connect();<br \/>\n}<\/p>\n<p>\/**<br \/>\n * send speed to smartphone<br \/>\n * @param speed<br \/>\n *\/<br \/>\nprivate void sendSpeed(final int speed) {<br \/>\n    new Thread(new Runnable() {<br \/>\n        @Override<br \/>\n        public void run() {<br \/>\n            final String message = String.valueOf(speed);<br \/>\n            NodeApi.GetConnectedNodesResult nodes = Wearable.NodeApi.getConnectedNodes(mGoogleApiClient).await();<br \/>\n            for (Node node : nodes.getNodes()) {<br \/>\n                MessageApi.SendMessageResult result = Wearable.MessageApi.sendMessage(<br \/>\n                        mGoogleApiClient,<br \/>\n                    node.getId(),<br \/>\n                    MESSAGE_PATH,<br \/>\n                    message.getBytes())<br \/>\n                    .await();<br \/>\n                if (result.getStatus().isSuccess()) {<br \/>\n                    Log.d(TAG, &quot;success:send to mobile&quot;);<br \/>\n                } else {<br \/>\n                    Log.e(TAG, &quot;failure:send to mobile&quot;);<br \/>\n                }<br \/>\n            }<br \/>\n        }<br \/>\n    }).start();<br \/>\n}<br \/>\n[\/java]<\/p>\n<h3>3-2. \u97f3\u58f0\u5165\u529b<\/h3>\n<p>\u6b21\u306b\u3001Android Wear\u306e\u30b9\u30de\u30fc\u30c8\u30a6\u30a9\u30c3\u30c1\u304b\u3089\u3001\u97f3\u58f0\u3067\u5165\u529b\u3059\u308b\u3002StartVoiceRecognitionActivity\u3067\u97f3\u58f0\u5165\u529b\u7528\u306eintent\u3092\u751f\u6210\u3057\u3001Activity\u3092\u8d77\u52d5\u3055\u305b\u308b\u3002\u97f3\u58f0\u5165\u529b\u3092\u7d42\u4e86\u3057\u3066\u623b\u3063\u3066\u304d\u305f\u3068\u304d\u306b\u3001onActivityResult\u5185\u3067\u3001\u305d\u306e\u97f3\u58f0\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3057\u3001\u30b9\u30de\u30fc\u30c8\u30d5\u30a9\u30f3\u3078\u9001\u4fe1\u3059\u308b\u3002<\/p>\n<p><strong>[Wear] MainActivity.java<\/strong><\/p>\n<p>[java]<br \/>\n&#8230;&#8230;&#8230;&#8230;(\u7701\u7565)&#8230;&#8230;&#8230;&#8230;<\/p>\n<p>\/**<br \/>\n * launch voice input activity<br \/>\n *\/<br \/>\nprivate void startVoiceRecognitionActivity() {<br \/>\n    Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);<br \/>\n    intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,<br \/>\n            RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);<br \/>\n    intent.putExtra(RecognizerIntent.EXTRA_PROMPT, R.string.voice_input_msg);<br \/>\n    startActivityForResult(intent, REQUEST_CODE);<br \/>\n}<\/p>\n<p>\/**<br \/>\n * receieve data from voice input activity<br \/>\n *\/<br \/>\n@Override<br \/>\nprotected void onActivityResult(int requestCode, int resultCode, Intent data) {<\/p>\n<p>    \/\/ return from voice input activity<br \/>\n    if (requestCode == REQUEST_CODE &amp;&amp; resultCode == RESULT_OK) {<br \/>\n        ArrayList&lt;String&gt; matches = data.getStringArrayListExtra(<br \/>\n                RecognizerIntent.EXTRA_RESULTS);<br \/>\n        String command = matches.get(0);<\/p>\n<p>        \/\/ add 20 if voice is &quot;speed up&quot;<br \/>\n        if (command.equals(SPEED_UP_VOICE) || command.equals(SPEED_DOWN_VOICE)) {<\/p>\n<p>            int speed = mSeekBar.getProgress();<br \/>\n            if (command.equals(SPEED_UP_VOICE)) {<br \/>\n                speed += 20;<br \/>\n                if (speed &gt; 100) {<br \/>\n                    speed = 100;<br \/>\n                }<br \/>\n            } else {<br \/>\n                speed -= 20;<br \/>\n                if (speed &lt; 0) {<br \/>\n                    speed = 0;<br \/>\n                }<br \/>\n            }<\/p>\n<p>            mSeekBar.setProgress(speed);<br \/>\n            sendSpeed(speed);<br \/>\n            mSpeedText.setText(String.valueOf(speed));<br \/>\n        }<br \/>\n    }<\/p>\n<p>    super.onActivityResult(requestCode, resultCode, data);<br \/>\n}<br \/>\n[\/java]<\/p>\n<h3>3-3. \u30b9\u30de\u30fc\u30c8\u30d5\u30a9\u30f3\u3067\u306e\u30c7\u30fc\u30bf\u306e\u53d7\u4fe1<\/h3>\n<p>\u6b21\u306b\u3001Mobile\u3067\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u53d7\u4fe1\u306e\u8a2d\u5b9a\u3092\u884c\u3046\u3002Mobile\u306eManifest.xml\u306eapplication\u30bf\u30b0\u5185\u306b\u3001wearable\u304b\u3089\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u53d7\u4fe1\u3059\u308b\u305f\u3081\u306eService\u3092\u767b\u9332\u3059\u308b\u3002<\/p>\n<p><strong>[Mobile]AndroidManifest.xml<\/strong><\/p>\n<p>[xml]<br \/>\n&#8230;&#8230;&#8230;&#8230;(\u7701\u7565)&#8230;&#8230;&#8230;&#8230;<br \/>\n&lt;service<br \/>\n    android:name=&quot;.WearableService&quot; &gt;<br \/>\n    &lt;intent-filter&gt;<br \/>\n        &lt;action android:name=&quot;com.google.android.gms.wearable.BIND_LISTENER&quot; \/&gt;<br \/>\n    &lt;\/intent-filter&gt;<br \/>\n&lt;\/service&gt;<br \/>\n&#8230;&#8230;&#8230;&#8230;(\u7701\u7565)&#8230;&#8230;&#8230;&#8230;<br \/>\n[\/xml]<\/p>\n<p>Android Wear\u304b\u3089\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u9001\u3089\u308c\u308b\u3068\u3001onMessageReceived\u304c\u547c\u3070\u308c\u308b\u3002onMessageReceived\u5185\u3067\u3001PubNub\u3078\u306e\u901a\u4fe1\u3092\u884c\u3046\u3002\u306a\u304a\u3001WearableService\u306f\u3001Android\u30b9\u30de\u30db\u5074\u3067\u30a2\u30d7\u30ea\u304c\u8d77\u52d5\u3057\u3066\u3044\u306a\u304f\u3066\u3082\u547c\u3073\u51fa\u3055\u308c\u308b\u305f\u3081\u3001Activity\u306e\u5b9f\u88c5\u306f\u4e0d\u8981\u3067\u3042\u308b(\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u4f5c\u6210\u6642\u306b\u81ea\u52d5\u3067\u4f5c\u3089\u308c\u305f\u307e\u307e\u3067\u3044\u3044)<\/p>\n<p><strong>[Mobile] WearableService.java<\/strong><\/p>\n<p>[java]<br \/>\npublic class WearableService extends WearableListenerService {<\/p>\n<p>    &#8230;&#8230;&#8230;&#8230;(\u7701\u7565)&#8230;&#8230;&#8230;&#8230;<\/p>\n<p>    \/**<br \/>\n     * called when receieve message from Android Wear<br \/>\n     * @param messageEvent<br \/>\n     *\/<br \/>\n    @Override<br \/>\n    public void onMessageReceived(MessageEvent messageEvent) {<br \/>\n        Log.d(TAG, &quot;onMessageReceived&quot;);<\/p>\n<p>        String speedStr = new String(messageEvent.getData());<br \/>\n        int speed = Integer.valueOf(speedStr);<\/p>\n<p>        \/\/ send speed to discoball<br \/>\n        updateDiscoBallSpeed(speed);<br \/>\n    }<\/p>\n<p>    &#8230;&#8230;&#8230;&#8230;(\u7701\u7565)&#8230;&#8230;&#8230;&#8230;<br \/>\n}<br \/>\n[\/java]<\/p>\n<h3>3-4. \u30b9\u30de\u30fc\u30c8\u30d5\u30a9\u30f3\u3068Raspberry Pi\u306e\u901a\u4fe1<\/h3>\n<p>\u305d\u308c\u3067\u306f\u3001Rasbperry Pi\u306b\u901f\u5ea6\u306e\u60c5\u5831\u3092\u9001\u4fe1\u3059\u308b\u30e1\u30bd\u30c3\u30c9\u3001updateDiscoBallSpeed\u306e\u5b9f\u88c5\u3092\u884c\u304a\u3046\u3002PubNub\u306eSDK\u3092\u4f7f\u3046\u3053\u3068\u3067\u3001\u975e\u5e38\u306b\u7c21\u5358\u306b\u5b9f\u88c5\u304c\u3067\u304d\u308b\u3002mobile\u306ebuild.gradle\u306bdependencies\u306bpubnub\u3092\u8ffd\u52a0\u3059\u308b\u3002<\/p>\n<p><strong>[Mobile] build.gradle<\/strong><\/p>\n<p>[code]<br \/>\n&#8230;&#8230;&#8230;&#8230;(\u7701\u7565)&#8230;&#8230;&#8230;&#8230;<\/p>\n<p>dependencies {<br \/>\n    compile fileTree(dir: &#8216;libs&#8217;, include: [&#8216;*.jar&#8217;])<br \/>\n    wearApp project(&#8216;:wear&#8217;)<br \/>\n    compile &#8216;com.android.support:appcompat-v7:21.0.3&#8217;<br \/>\n    compile &#8216;com.google.android.gms:play-services:6.5.87&#8217;<\/p>\n<p>    compile &#8216;com.pubnub:pubnub:3.7.2+&#8217;<br \/>\n}<br \/>\n[\/code]<\/p>\n<p>OnCreate\u306a\u3069\u3067Pubnub\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u521d\u671f\u5316\u3057\u3066\u304a\u3051\u3070\u3001Pubnub\u306epublish\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3063\u3066\u3001Raspberry Pi\u306b\u901f\u5ea6\u3092\u9001\u4fe1\u3067\u304d\u308b\u3002<\/p>\n<p><strong>[Mobile] WearableService.java<\/strong><\/p>\n<p>[java]<br \/>\n&#8230;&#8230;&#8230;&#8230;(\u7701\u7565)&#8230;&#8230;&#8230;&#8230;<\/p>\n<p>@Override<br \/>\npublic void onCreate() {<br \/>\n    super.onCreate();<br \/>\n    mPubnub = new Pubnub(<br \/>\n        PUBNUB_PUBLISH_KEY,<br \/>\n        PUBNUB_SUBSCRIBE_KEY,<br \/>\n        &quot;&quot;,      \/\/ SECRET_KEY<br \/>\n        &quot;&quot;,      \/\/ CIPHER_KEY<br \/>\n        false    \/\/ SSL_ON?<br \/>\n    );<br \/>\n}<\/p>\n<p>\/**<br \/>\n * send to pubnub, change disco ball speed<br \/>\n * @param speed rotation speed (0 &#8211; 100)<br \/>\n *\/<br \/>\nprivate void updateDiscoBallSpeed(int speed) {<br \/>\n    try {<br \/>\n        Log.d(TAG, &quot;speed:&quot; + speed);<\/p>\n<p>        JSONObject object = new JSONObject();<br \/>\n        object.put(PUBNUB_SPEED_KEY, speed);<br \/>\n        mPubnub.publish(CHANNEL_C_CONTROL, object, new Callback() {<br \/>\n            @Override<br \/>\n            public void successCallback(String channel, Object message) {<br \/>\n                super.successCallback(channel, message);<br \/>\n                Log.i(TAG, message.toString());<br \/>\n            }<\/p>\n<p>            @Override<br \/>\n            public void errorCallback(String channel, PubnubError error) {<br \/>\n                super.errorCallback(channel, error);<br \/>\n                Log.e(TAG, error.toString());<br \/>\n            }<br \/>\n        });<\/p>\n<p>    } catch (JSONException e) {<br \/>\n        e.printStackTrace();<br \/>\n    }<br \/>\n}<\/p>\n<p>&#8230;&#8230;&#8230;&#8230;(\u7701\u7565)&#8230;&#8230;&#8230;&#8230;<br \/>\n[\/java]<\/p>\n<p>\u3053\u308c\u306b\u3088\u308a\u3001\u30b9\u30de\u30fc\u30c8\u30a6\u30a9\u30c3\u30c1\u306b\u97f3\u58f0\u5165\u529b\u3057\u305f\u30b3\u30de\u30f3\u30c9\u304c\u3001Raspberry Pi\u306b\u9001\u3089\u308c\u3001\u30df\u30e9\u30fc\u30dc\u30fc\u30eb\u306e\u901f\u5ea6\u3092\u5909\u5316\u3055\u305b\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u5b9f\u88c5\u3067\u304d\u305f\u3002\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306f\u3001Github\u3067\u516c\u958b\u3057\u3066\u3044\u308b\u3002<a href=\"https:\/\/github.com\/btrax\/smart-disco-ball\" target=\"_blank\" rel=\"noopener\">\u3053\u3061\u3089<\/a>\u3002<\/p>\n<h2>btrax\u306eSF\u672c\u793e\u30aa\u30d5\u30a3\u30b9\u3067\u52d5\u304f\u30b9\u30de\u30fc\u30c8\u30df\u30e9\u30fc\u30dc\u30fc\u30eb<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-29865 aligncenter\" src=\"https:\/\/blog.btrax.com\/jp\/wp-content\/uploads\/sites\/3\/2015\/05\/main-pic1.jpg\" alt=\"main-pic\" width=\"780\" height=\"460\" srcset=\"https:\/\/blog.btrax.com\/jp\/wp-content\/uploads\/sites\/3\/2015\/05\/main-pic1.jpg 780w, https:\/\/blog.btrax.com\/jp\/wp-content\/uploads\/sites\/3\/2015\/05\/main-pic1-300x177.jpg 300w, https:\/\/blog.btrax.com\/jp\/wp-content\/uploads\/sites\/3\/2015\/05\/main-pic1-704x415.jpg 704w, https:\/\/blog.btrax.com\/jp\/wp-content\/uploads\/sites\/3\/2015\/05\/main-pic1-653x385.jpg 653w, https:\/\/blog.btrax.com\/jp\/wp-content\/uploads\/sites\/3\/2015\/05\/main-pic1-341x201.jpg 341w, https:\/\/blog.btrax.com\/jp\/wp-content\/uploads\/sites\/3\/2015\/05\/main-pic1-624x368.jpg 624w\" sizes=\"auto, (max-width: 780px) 100vw, 780px\" \/><\/p>\n<h3>btrax\u3067\u306f\u30d7\u30ed\u30c8\u30bf\u30a4\u30d7\u958b\u767a\u4e2d!\u30a8\u30f3\u30b8\u30cb\u30a2\u3082\u52df\u96c6<\/h3>\n<p>btrax\u3067\u306f\u3001IoT\u30c7\u30d0\u30a4\u30b9\u306e\u5e02\u5834\u8abf\u67fb\u3001UX\u7814\u7a76\u3092\u76ee\u7684\u306b\u4eca\u56de\u7d39\u4ecb\u3057\u305f\u30df\u30e9\u30fc\u30dc\u30fc\u30eb\u306e\u3088\u3046\u306aIoT\u30d7\u30ed\u30c8\u30bf\u30a4\u30d7\u3092\u958b\u767a\u3057\u3066\u3044\u308b\u3002<\/p>\n<p>\u5c06\u6765\u7684\u306b\u306f\u3001\u7c73\u56fd\u3067\u30af\u30e9\u30a6\u30c9\u30d5\u30a1\u30f3\u30c7\u30a3\u30f3\u30b0\u3092\u5b9f\u65bd\u3057\u3001\u81ea\u793eIoT\u30c7\u30d0\u30a4\u30b9\u958b\u767a\u3092\u884c\u3046\u3053\u3068\u3082\u4e88\u5b9a\u3057\u3066\u3044\u308b\u3002\u30b7\u30ea\u30b3\u30f3\u30d0\u30ec\u30fc\u3001\u30b5\u30f3\u30d5\u30e9\u30f3\u30b7\u30b9\u30b3\u3067\u6700\u5148\u7aef\u306eIoT\u4e8b\u60c5\u3092\u5b66\u3073\u305f\u3044\u30a8\u30f3\u30b8\u30cb\u30a2\u3001\u7c73\u56fd\u5411\u3051\u306bIoT\u3092\u958b\u767a\u3057\u3001\u30d7\u30ed\u30c0\u30af\u30c8\u5316\u3092\u76ee\u6307\u3057\u305f\u3044\u30a8\u30f3\u30b8\u30cb\u30a2\u3092\u52df\u96c6\u3057\u3066\u3044\u308b\u3002<\/p>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>btrax\u306f\u3001\u30a4\u30ce\u30d9\u30fc\u30b7\u30e7\u30f3\u306e\u6700\u5148\u7aef\u3092\u884c\u304f\u672c\u5834\u30b5\u30f3\u30d5\u30e9\u30f3\u30b7\u30b9\u30b3\u30fb\u30b7\u30ea\u30b3\u30f3\u30d0\u30ec\u30fc\u3067\u77ed\u671f\u96c6\u4e2d\u5c11\u6570\u7cbe\u92ed\u3067\u30a4\u30ce\u30d9\u30fc\u30b7\u30e7\u30f3\u5275\u51fa\u306b\u30c1\u30e3\u30ec\u30f3\u30b8\u3067\u304d\u308b\u300c\u30a4\u30ce\u30d9\u30fc\u30b7\u30e7\u30f3 \u30d7\u30ed\u30b0\u30e9\u30e0\u300d\u3092\u63d0\u4f9b\u3057\u3066\u3044\u308b\u3002 \u307e\u305f\u3001\u30e2\u30d0\u30a4\u30eb\u30a2\u30d7\u30ea\u3084Web\u30b5\u30fc\u30d3\u30b9\u3060 [&hellip;]<\/p>\n","protected":false},"author":80,"featured_media":29865,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[230],"tags":[268],"class_list":["post-29699","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology","tag-iot"],"acf":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/blog.btrax.com\/jp\/wp-json\/wp\/v2\/posts\/29699","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.btrax.com\/jp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.btrax.com\/jp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.btrax.com\/jp\/wp-json\/wp\/v2\/users\/80"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.btrax.com\/jp\/wp-json\/wp\/v2\/comments?post=29699"}],"version-history":[{"count":33,"href":"https:\/\/blog.btrax.com\/jp\/wp-json\/wp\/v2\/posts\/29699\/revisions"}],"predecessor-version":[{"id":55468,"href":"https:\/\/blog.btrax.com\/jp\/wp-json\/wp\/v2\/posts\/29699\/revisions\/55468"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.btrax.com\/jp\/wp-json\/wp\/v2\/media\/29865"}],"wp:attachment":[{"href":"https:\/\/blog.btrax.com\/jp\/wp-json\/wp\/v2\/media?parent=29699"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.btrax.com\/jp\/wp-json\/wp\/v2\/categories?post=29699"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.btrax.com\/jp\/wp-json\/wp\/v2\/tags?post=29699"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}