{"id":123,"date":"2012-02-08T13:08:31","date_gmt":"2012-02-08T04:08:31","guid":{"rendered":"http:\/\/www.gvc-on.net\/?page_id=123"},"modified":"2014-01-21T14:51:56","modified_gmt":"2014-01-21T05:51:56","slug":"arduino-i2c-module-scanner-wire-library-only","status":"publish","type":"page","link":"https:\/\/www.gvc-on.net\/?page_id=123","title":{"rendered":"Arduino I2C Module Scanner (Wire Library Only)"},"content":{"rendered":"<p>Arduino \u306b\u63a5\u7d9a\u3057\u305fI2C\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u691c\u7d22\u3059\u308b\u30b5\u30f3\u30d7\u30eb\u30bd\u30fc\u30b9\u3067\u3059\u3002<br \/>\nWire\u30e9\u30a4\u30d6\u30e9\u30ea\u3057\u304b\u4f7f\u3063\u3066\u3044\u306a\u3044\u306e\u3067\u30bd\u30fc\u30b9\u304c\u30b7\u30f3\u30d7\u30eb\u3067\u3059\u3002:-)<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\n\r\n\/\/ --------------------------------------------------\r\n\/\/ Global Versatile Controler\r\n\/\/ --------------------------------------------------\r\n\/\/ --------------------------------------------------\r\n\/\/ Memo\r\n\/\/ --------------------------------------------------\r\n\/\/ ------------------------------\r\n\/\/ BASE\r\n\/\/ ------------------------------\r\n\/\/ I2C Module Scan by Wire Liblary, for Arduino.\r\n\/\/\r\n\/\/ New BSD License. Copyright (c) 2011-2012, Future Versatile Group\r\n\/\/ All rights reserved.\r\n\/\/\r\n\/\/ 2012.02.08 T.Kabu http:\/\/www.gvc-on.net\/\r\n\/\/\r\n\/\/ http:\/\/todbot.com\/blog\/2009\/11\/29\/i2cscanner-pde-arduino-as-i2c-bus-scanner\/  ... I2C bus scanner for Arduino\r\n\r\n#include &quot;Wire.h&quot;\r\n\r\n\/\/ ------------------------------\r\n\/\/ GVC Module Scan\r\n\/\/ ------------------------------\r\nvoid gvc_module_scan(byte from_id, byte to_id)\r\n{\r\n    char    module_id;    \/\/ Target I2C ID\r\n    byte    data;         \/\/ Dummy data\r\n    byte    result;       \/\/ Result of TX\r\n\r\n    \/\/ Open I2C device\r\n    Wire.begin();\r\n\r\n    \/\/ I2C Module Scan, from_id ... to_id\r\n    for (module_id = from_id; module_id &lt;= to_id; module_id ++)\r\n    {\r\n        Wire.beginTransmission(module_id);\r\n        Wire.write(&amp;data, 0);\r\n        result = Wire.endTransmission();\r\n\r\n        \/\/ I2C Module found out!\r\n        if (result == 0)\r\n        {\r\n            Serial.print(&quot;I2C Module Found! ID = &quot;);\r\n            Serial.println(module_id, DEC);\r\n        }\r\n    }\r\n}\r\n\r\nvoid setup()\r\n{\r\n    \/\/ Serial Start!\r\n    Serial.begin(9600);\r\n    Serial.print(&quot;Wire(I2C) ID Scan.\\n&quot;);\r\n\r\n    \/\/ I2C Module Scan\r\n    gvc_module_scan(1, 100);\r\n\r\n    Serial.print(&quot;\\nEND\\n&quot;);\r\n}\r\n\r\nvoid loop()\r\n{\r\n    digitalWrite(13,HIGH);\r\n    delay(500);\r\n\r\n    digitalWrite(13,LOW);\r\n    delay(500);\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Arduino \u306b\u63a5\u7d9a\u3057\u305fI2C\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u691c\u7d22\u3059\u308b\u30b5\u30f3\u30d7\u30eb\u30bd\u30fc\u30b9\u3067\u3059\u3002 Wire\u30e9\u30a4\u30d6\u30e9\u30ea\u3057\u304b\u4f7f\u3063\u3066\u3044\u306a\u3044\u306e\u3067\u30bd\u30fc\u30b9\u304c\u30b7\u30f3\u30d7\u30eb\u3067\u3059\u3002:-) \/\/ &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &hellip; <a href=\"https:\/\/www.gvc-on.net\/?page_id=123\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":521,"menu_order":0,"comment_status":"closed","ping_status":"open","template":"","meta":{"footnotes":""},"class_list":["post-123","page","type-page","status-publish","hentry"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.8 - aioseo.com -->\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.gvc-on.net\/?page_id=123\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.8\" \/>\n\t\t<meta property=\"og:locale\" content=\"ja_JP\" \/>\n\t\t<meta property=\"og:site_name\" content=\"GVC : Global Versatile Controller | Linux\u3068PIC\u3092\u4f7f\u3063\u305f\u5404\u7a2e\u30e2\u30b8\u30e5\u30fc\u30eb\u3067\u304a\u624b\u8efd\u306b\u6c4e\u7528\u5236\u5fa1\u3092\u3057\u3088\u3046\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Arduino I2C Module Scanner (Wire Library Only) | GVC : Global Versatile Controller\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.gvc-on.net\/?page_id=123\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2012-02-08T04:08:31+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2014-01-21T05:51:56+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Arduino I2C Module Scanner (Wire Library Only) | GVC : Global Versatile Controller\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.gvc-on.net\\\/?page_id=123#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.gvc-on.net#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.gvc-on.net\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.gvc-on.net\\\/?page_id=116#listItem\",\"name\":\"\\u30c0\\u30a6\\u30f3\\u30ed\\u30fc\\u30c9\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.gvc-on.net\\\/?page_id=116#listItem\",\"position\":2,\"name\":\"\\u30c0\\u30a6\\u30f3\\u30ed\\u30fc\\u30c9\",\"item\":\"https:\\\/\\\/www.gvc-on.net\\\/?page_id=116\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.gvc-on.net\\\/?page_id=521#listItem\",\"name\":\"[OLD] \\u65e7\\u60c5\\u5831\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.gvc-on.net#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.gvc-on.net\\\/?page_id=521#listItem\",\"position\":3,\"name\":\"[OLD] \\u65e7\\u60c5\\u5831\",\"item\":\"https:\\\/\\\/www.gvc-on.net\\\/?page_id=521\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.gvc-on.net\\\/?page_id=123#listItem\",\"name\":\"Arduino I2C Module Scanner (Wire Library Only)\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.gvc-on.net\\\/?page_id=116#listItem\",\"name\":\"\\u30c0\\u30a6\\u30f3\\u30ed\\u30fc\\u30c9\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.gvc-on.net\\\/?page_id=123#listItem\",\"position\":4,\"name\":\"Arduino I2C Module Scanner (Wire Library Only)\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.gvc-on.net\\\/?page_id=521#listItem\",\"name\":\"[OLD] \\u65e7\\u60c5\\u5831\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.gvc-on.net\\\/#organization\",\"name\":\"GVC : Global Versatile Controller\",\"description\":\"Linux\\u3068PIC\\u3092\\u4f7f\\u3063\\u305f\\u5404\\u7a2e\\u30e2\\u30b8\\u30e5\\u30fc\\u30eb\\u3067\\u304a\\u624b\\u8efd\\u306b\\u6c4e\\u7528\\u5236\\u5fa1\\u3092\\u3057\\u3088\\u3046\",\"url\":\"https:\\\/\\\/www.gvc-on.net\\\/\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.gvc-on.net\\\/?page_id=123#webpage\",\"url\":\"https:\\\/\\\/www.gvc-on.net\\\/?page_id=123\",\"name\":\"Arduino I2C Module Scanner (Wire Library Only) | GVC : Global Versatile Controller\",\"inLanguage\":\"ja\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.gvc-on.net\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.gvc-on.net\\\/?page_id=123#breadcrumblist\"},\"datePublished\":\"2012-02-08T13:08:31+09:00\",\"dateModified\":\"2014-01-21T14:51:56+09:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.gvc-on.net\\\/#website\",\"url\":\"https:\\\/\\\/www.gvc-on.net\\\/\",\"name\":\"GVC : Global Versatile Controller\",\"description\":\"Linux\\u3068PIC\\u3092\\u4f7f\\u3063\\u305f\\u5404\\u7a2e\\u30e2\\u30b8\\u30e5\\u30fc\\u30eb\\u3067\\u304a\\u624b\\u8efd\\u306b\\u6c4e\\u7528\\u5236\\u5fa1\\u3092\\u3057\\u3088\\u3046\",\"inLanguage\":\"ja\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.gvc-on.net\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Arduino I2C Module Scanner (Wire Library Only) | GVC : Global Versatile Controller","description":"","canonical_url":"https:\/\/www.gvc-on.net\/?page_id=123","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BreadcrumbList","@id":"https:\/\/www.gvc-on.net\/?page_id=123#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/www.gvc-on.net#listItem","position":1,"name":"Home","item":"https:\/\/www.gvc-on.net","nextItem":{"@type":"ListItem","@id":"https:\/\/www.gvc-on.net\/?page_id=116#listItem","name":"\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9"}},{"@type":"ListItem","@id":"https:\/\/www.gvc-on.net\/?page_id=116#listItem","position":2,"name":"\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9","item":"https:\/\/www.gvc-on.net\/?page_id=116","nextItem":{"@type":"ListItem","@id":"https:\/\/www.gvc-on.net\/?page_id=521#listItem","name":"[OLD] \u65e7\u60c5\u5831"},"previousItem":{"@type":"ListItem","@id":"https:\/\/www.gvc-on.net#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/www.gvc-on.net\/?page_id=521#listItem","position":3,"name":"[OLD] \u65e7\u60c5\u5831","item":"https:\/\/www.gvc-on.net\/?page_id=521","nextItem":{"@type":"ListItem","@id":"https:\/\/www.gvc-on.net\/?page_id=123#listItem","name":"Arduino I2C Module Scanner (Wire Library Only)"},"previousItem":{"@type":"ListItem","@id":"https:\/\/www.gvc-on.net\/?page_id=116#listItem","name":"\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9"}},{"@type":"ListItem","@id":"https:\/\/www.gvc-on.net\/?page_id=123#listItem","position":4,"name":"Arduino I2C Module Scanner (Wire Library Only)","previousItem":{"@type":"ListItem","@id":"https:\/\/www.gvc-on.net\/?page_id=521#listItem","name":"[OLD] \u65e7\u60c5\u5831"}}]},{"@type":"Organization","@id":"https:\/\/www.gvc-on.net\/#organization","name":"GVC : Global Versatile Controller","description":"Linux\u3068PIC\u3092\u4f7f\u3063\u305f\u5404\u7a2e\u30e2\u30b8\u30e5\u30fc\u30eb\u3067\u304a\u624b\u8efd\u306b\u6c4e\u7528\u5236\u5fa1\u3092\u3057\u3088\u3046","url":"https:\/\/www.gvc-on.net\/"},{"@type":"WebPage","@id":"https:\/\/www.gvc-on.net\/?page_id=123#webpage","url":"https:\/\/www.gvc-on.net\/?page_id=123","name":"Arduino I2C Module Scanner (Wire Library Only) | GVC : Global Versatile Controller","inLanguage":"ja","isPartOf":{"@id":"https:\/\/www.gvc-on.net\/#website"},"breadcrumb":{"@id":"https:\/\/www.gvc-on.net\/?page_id=123#breadcrumblist"},"datePublished":"2012-02-08T13:08:31+09:00","dateModified":"2014-01-21T14:51:56+09:00"},{"@type":"WebSite","@id":"https:\/\/www.gvc-on.net\/#website","url":"https:\/\/www.gvc-on.net\/","name":"GVC : Global Versatile Controller","description":"Linux\u3068PIC\u3092\u4f7f\u3063\u305f\u5404\u7a2e\u30e2\u30b8\u30e5\u30fc\u30eb\u3067\u304a\u624b\u8efd\u306b\u6c4e\u7528\u5236\u5fa1\u3092\u3057\u3088\u3046","inLanguage":"ja","publisher":{"@id":"https:\/\/www.gvc-on.net\/#organization"}}]},"og:locale":"ja_JP","og:site_name":"GVC : Global Versatile Controller | Linux\u3068PIC\u3092\u4f7f\u3063\u305f\u5404\u7a2e\u30e2\u30b8\u30e5\u30fc\u30eb\u3067\u304a\u624b\u8efd\u306b\u6c4e\u7528\u5236\u5fa1\u3092\u3057\u3088\u3046","og:type":"article","og:title":"Arduino I2C Module Scanner (Wire Library Only) | GVC : Global Versatile Controller","og:url":"https:\/\/www.gvc-on.net\/?page_id=123","article:published_time":"2012-02-08T04:08:31+00:00","article:modified_time":"2014-01-21T05:51:56+00:00","twitter:card":"summary","twitter:title":"Arduino I2C Module Scanner (Wire Library Only) | GVC : Global Versatile Controller"},"aioseo_meta_data":{"post_id":"123","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"WebPage","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2020-12-24 01:24:43","updated":"2025-06-04 03:34:18","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.gvc-on.net\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.gvc-on.net\/?page_id=116\" title=\"\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\">\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.gvc-on.net\/?page_id=521\" title=\"[OLD] \u65e7\u60c5\u5831\">[OLD] \u65e7\u60c5\u5831<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tArduino I2C Module Scanner (Wire Library Only)\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.gvc-on.net"},{"label":"\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9","link":"https:\/\/www.gvc-on.net\/?page_id=116"},{"label":"[OLD] \u65e7\u60c5\u5831","link":"https:\/\/www.gvc-on.net\/?page_id=521"},{"label":"Arduino I2C Module Scanner (Wire Library Only)","link":"https:\/\/www.gvc-on.net\/?page_id=123"}],"_links":{"self":[{"href":"https:\/\/www.gvc-on.net\/index.php?rest_route=\/wp\/v2\/pages\/123","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gvc-on.net\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.gvc-on.net\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.gvc-on.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gvc-on.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=123"}],"version-history":[{"count":14,"href":"https:\/\/www.gvc-on.net\/index.php?rest_route=\/wp\/v2\/pages\/123\/revisions"}],"predecessor-version":[{"id":523,"href":"https:\/\/www.gvc-on.net\/index.php?rest_route=\/wp\/v2\/pages\/123\/revisions\/523"}],"up":[{"embeddable":true,"href":"https:\/\/www.gvc-on.net\/index.php?rest_route=\/wp\/v2\/pages\/521"}],"wp:attachment":[{"href":"https:\/\/www.gvc-on.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=123"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}