{"id":172,"date":"2020-02-13T06:50:47","date_gmt":"2020-02-12T21:50:47","guid":{"rendered":"http:\/\/drroot.page\/wp\/?p=172"},"modified":"2020-10-15T09:23:45","modified_gmt":"2020-10-15T00:23:45","slug":"wroom-02esp8266%e3%81%a7%e3%82%bd%e3%82%b1%e3%83%83%e3%83%88%e3%82%b5%e3%83%bc%e3%83%90%e3%82%92%e5%bb%ba%e3%81%a6%e3%82%8b","status":"publish","type":"post","link":"https:\/\/drroot.page\/wp\/?p=172","title":{"rendered":"WROOM 02(ESP8266)\u3067\u30bd\u30b1\u30c3\u30c8\u30b5\u30fc\u30d0\u3092\u5efa\u3066\u308b"},"content":{"rendered":"<h1>\u304c\u3044\u3088\u3046<\/h1>\n<p>WROOM02\u306f650\u5186\u3067\u8cb7\u3048\u308b\u7d50\u69cb\u30cf\u30a4\u30b9\u30da\u306aWiFi\u5185\u8535\u30de\u30a4\u30b3\u30f3\u30e2\u30b8\u30e5\u30fc\u30eb\u3002<br \/>\n<a href=\"http:\/\/akizukidenshi.com\/catalog\/g\/gK-09758\/\">http:\/\/akizukidenshi.com\/catalog\/g\/gK-09758\/<\/a><br \/>\n\u3053\u3044\u3064\u3067\u5b85\u5185\u306eWiFi\u306b\u63a5\u7d9a\u3057\u3001\u30ed\u30fc\u30ab\u30eb\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u5185\u306b\u56fa\u5b9aIP\u306e\u30b5\u30fc\u30d0\u30fc\u3092\u5efa\u3066\u308b\u8a71\u3002<br \/>\n\u30aa\u30ea\u30b8\u30ca\u30eb\u306e\u30bd\u30fc\u30b9\u3092\u8aad\u3081\u3070\u4e00\u767a\u3067\u5206\u304b\u308b\u8a71\u3060\u304c\u3001\u5099\u5fd8\u9332\u3068\u3057\u3066\u6b8b\u3059\u3002<br \/>\n\u3084\u3063\u3066\u308b\u4e8b\u306f\u300cTCP\u30bd\u30b1\u30c3\u30c8\u3067\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u53d7\u3051\u308b\u300d\u3060\u3051\u3067\u3001\u60f3\u5b9a\u3068\u3057\u3066\u306f\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306b\u3076\u3089\u4e0b\u304c\u3063\u305fPC\u7b49\u304b\u3089\u81ea\u4f5c\u30c7\u30d0\u30a4\u30b9(WROOM02)\u3092\u64cd\u4f5c\u3059\u308b\u307f\u305f\u3044\u306a\u611f\u3058\u3060\u3002<\/p>\n<h1>\u305c\u3093\u3076\u3093<\/h1>\n<pre><code class=\"language-cpp\">#include &lt;ESP8266WiFi.h&gt;\n\n\/**************************\/\n\/*wifi static configration*\/\n\/**************************\/\nchar ssid[] = &quot;WiFi\u306eSSID&quot;;\nchar pass[] = &quot;WiFi\u306e\u30d1\u30b9\u30ef\u30fc\u30c9&quot;;\nIPAddress ip(192, 168, 1, 111);\nIPAddress gateway(192,168,1,255);\nIPAddress subnet(255,255,255,0);\nWiFiServer server(11111); \/\/port\n\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\nconst int led = 2; \/\/status led pin\n\nvoid beginConnect() {\n  WiFi.begin(ssid, pass);\n  while (WiFi.status() != WL_CONNECTED) {\n    delay(200);\n  }\n  server.begin();\n  digitalWrite(led, HIGH);\n}\n\n\/************************\/\n\/***  main functions  ***\/\n\/************************\/\nvoid setup() {\n  pinMode(led, OUTPUT);\n  WiFi.config(ip,gateway,subnet);\n\n  \/\/use for debug\n  Serial.begin(115200);\n  Serial.println(&quot;\\nbegin&quot;);\n}\n\nvoid loop() {\n  if (WiFi.status() == WL_CONNECTED) {\n    WiFiClient c = server.available();\n    if (c) {\n      while(c.connected()){\n        if(c.available()){\n          char str[64]={0};\n          c.read((uint8_t*)str,63);\n          Serial.println(str);\n        }\n      }\n    }\n  }\n  else {\n    beginConnect();\n  }\n}<\/code><\/pre>\n<h1>\u304b\u3044\u305b\u3064<\/h1>\n<p>Wroom02\u306eWiFi\u30e9\u30a4\u30d6\u30e9\u30ea\u306f\u3001Arduino\u30aa\u30ea\u30b8\u30ca\u30eb\u306eWiFi\u30af\u30e9\u30b9\u306b\u6982\u306d\u6e96\u62e0\u3057\u3066\u3044\u308b\u3002<br \/>\n\u305d\u306e\u305f\u3081Arduino\u516c\u5f0f\u306e\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9\u3092\u898b\u308c\u3070\u30b5\u30f3\u30d7\u30eb\u3068\u3057\u3066\u306f\u5341\u5206\u6a5f\u80fd\u3059\u308b\u3002<br \/>\n<a href=\"https:\/\/www.arduino.cc\/en\/Reference\/WiFi\">https:\/\/www.arduino.cc\/en\/Reference\/WiFi<\/a><\/p>\n<p>\u8e93\u304d\u30dd\u30a4\u30f3\u30c8\u3068\u3057\u3066\u3001<code>WiFi.config(ip,gateway,subnet);<\/code>\u304c\u3042\u308b\u3002<br \/>\n\u30aa\u30ea\u30b8\u30ca\u30eb\u3067\u306f<code>WiFi.config(ip);<\/code>\u306e\u307f\u3067\u52d5\u4f5c\u3059\u308b\u304c\u3001WROOM02\u3067\u306fgateway\u3068subnet\u3092\u7701\u7565\u51fa\u6765\u306a\u3044\u4ed5\u69d8\u3067\u3042\u308b\u3002<br \/>\n\u305d\u308c\u3055\u3048\u6307\u5b9a\u3057\u3066\u3084\u308c\u3070\u56fa\u5b9aIP\u3067\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306b\u3076\u3089\u4e0b\u3052\u3089\u308c\u308b\u3002<\/p>\n<p>\u307e\u305f\u3053\u308c\u306f\u672c\u5bb6\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u8e93\u304d\u30dd\u30a4\u30f3\u30c8\u306a\u3093\u3060\u304c\u3001loop()\u5185\u3067\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u634c\u304f\u4ed5\u69d8\u4e0a\u3001<code>while(c.connected())<\/code>\u3067\u51e6\u7406\u3092\u56fa\u3081\u308b\u5fc5\u8981\u304c\u3042\u308b\u3002<br \/>\nwhile\u3092\u6d3b\u7528\u3057\u306a\u3044\u3068\u30d6\u30ed\u30c3\u30af\u3092\u629c\u3051\u3066\u3057\u307e\u3044\u3001\u30b3\u30cd\u30af\u30b7\u30e7\u30f3\u304c\u5373\u5ea7\u306b\u65ad\u305f\u308c\u3066\u3057\u307e\u3046\u3002<br \/>\n\u2026loop\u95a2\u6570\u306e\u5b58\u5728\u304c\u524d\u63d0\u306eArduino\u3068\u3001\u5272\u308a\u8fbc\u307f\u7684\u306b\u767a\u751f\u3059\u308b\u30ea\u30af\u30a8\u30b9\u30c8\u306e\u51e6\u7406\u306f\u672c\u8cea\u7684\u306b\u76f8\u6027\u304c\u60aa\u3044\u6c17\u304c\u3059\u308b\u2026\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u304c\u3044\u3088\u3046 WROOM02\u306f650\u5186\u3067\u8cb7\u3048\u308b\u7d50\u69cb\u30cf\u30a4\u30b9\u30da\u306aWiFi\u5185\u8535\u30de\u30a4\u30b3\u30f3\u30e2\u30b8 &hellip; <a href=\"https:\/\/drroot.page\/wp\/?p=172\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,2],"tags":[],"class_list":["post-172","post","type-post","status-publish","format-standard","hentry","category-it","category-2"],"_links":{"self":[{"href":"https:\/\/drroot.page\/wp\/index.php?rest_route=\/wp\/v2\/posts\/172","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/drroot.page\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/drroot.page\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/drroot.page\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/drroot.page\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=172"}],"version-history":[{"count":1,"href":"https:\/\/drroot.page\/wp\/index.php?rest_route=\/wp\/v2\/posts\/172\/revisions"}],"predecessor-version":[{"id":212,"href":"https:\/\/drroot.page\/wp\/index.php?rest_route=\/wp\/v2\/posts\/172\/revisions\/212"}],"wp:attachment":[{"href":"https:\/\/drroot.page\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=172"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/drroot.page\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=172"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/drroot.page\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=172"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}