{"id":453,"date":"2015-09-15T01:38:18","date_gmt":"2015-09-14T16:38:18","guid":{"rendered":"http:\/\/goji2100.s199.coreserver.jp\/blog\/?p=453"},"modified":"2022-04-11T07:07:54","modified_gmt":"2022-04-10T22:07:54","slug":"esp-wroom-02-wi-fi%e3%83%a9%e3%82%b8%e3%82%b3%e3%83%b3%e3%82%ab%e3%83%bc","status":"publish","type":"post","link":"http:\/\/goji2100.com\/blog\/?p=453","title":{"rendered":"ESP-WROOM-02 Wi-Fi\u30e9\u30b8\u30b3\u30f3\u30ab\u30fc"},"content":{"rendered":"<p>\u5b89\u4fa1\u306aWi-Fi\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u4f7f\u3063\u3066iPhone\u304b\u3089\u64cd\u4f5c\u3059\u308b\u30e9\u30b8\u30b3\u30f3\u30ab\u30fc\u3092\u4f5c\u308a\u307e\u3057\u305f\u3002<\/p>\n<p><strong>\u30ea\u30e2\u30b3\u30f3\u53d7\u4fe1\u5074(ESP-WROOM-02)<\/strong><br \/>\n\u53d7\u4fe1\u5074\u306fAP\u30e2\u30fc\u30c9\u3067\u52d5\u4f5c\u3057\u3001\u30a2\u30af\u30bb\u30b9\u30dd\u30a4\u30f3\u30c8\u7121\u3057\u3067iPhone\u3068\u76f4\u63a5\u63a5\u7d9a\u3057\u307e\u3059\u3002<br \/>\n\u5de6\u53f3\u306b\u30ae\u30a2\u30e2\u30fc\u30bf\u3092\u53d6\u4ed8\u3051\u305f\u53f0\u8eca\uff08\u30d0\u30c3\u30c6\u30ea\u30b1\u30fc\u30b9\uff09\u306b\u642d\u8f09\u3057\u3001iPhone\u4e0a\u306eiOSC\u30a2\u30d7\u30ea\u304b\u3089\u306e\u30b3\u30de\u30f3\u30c9\u3092\u53d7\u4fe1\u3057\u3066\u52d5\u4f5c\u3057\u307e\u3059\u3002<br \/>\n\u30b3\u30de\u30f3\u30c9\u306f\u3001\u5de6\u53f3\u306e\u30e2\u30fc\u30bf\u56de\u8ee2\u901f\u5ea6\u3001\u56de\u8ee2\u65b9\u5411\u306e\u5236\u5fa1\u3001\u30d8\u30c3\u30c9\u30e9\u30a4\u30c8\u306e\u70b9\u706f\u3001\u8b66\u7b1b\u306e\u9cf4\u52d5\u3092\u7528\u610f\u3057\u307e\u3057\u305f\u3002<br \/>\n<span style=\"color: #999999;\">\uff0a\u30e2\u30fc\u30bf\u30fc\u306e\u5927\u304d\u3055\u306b\u6bd4\u3079\u3066\u30d5\u30eb\u30d6\u30ea\u30c3\u30b8\u304c\u5927\u304d\u3081\u3067\u3059\u304c\u3001\u65e7\u4f5c\u306e\u6d41\u7528\u3067\u3059\u306e\u3067\u30fb\u30fb<\/span><\/p>\n<div id=\"attachment_454\" style=\"width: 370px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/goji2100.com\/blog\/wp-content\/uploads\/2015\/09\/ESP8266CAR.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-454\" class=\"wp-image-454\" src=\"https:\/\/goji2100.com\/blog\/wp-content\/uploads\/2015\/09\/ESP8266CAR-300x138.jpg\" alt=\"ESP-WROOM-02 Wi-Fi\u30e9\u30b8\u30b3\u30f3\u30ab\u30fc\" width=\"360\" height=\"166\" \/><\/a><p id=\"caption-attachment-454\" class=\"wp-caption-text\">ESP-WROOM-02 Wi-Fi\u30e9\u30b8\u30b3\u30f3\u30ab\u30fc<\/p><\/div>\n<p><!--more \u3010\u7d9a\u304d\u3092\u8aad\u3080\u3011--><\/p>\n<p>\u30e2\u30fc\u30bf\u30fc\u30ae\u30a2\uff1a<a href=\"https:\/\/tiisai.dip.jp\/?p=2676\" target=\"_blank\" rel=\"noopener\">\u3061\u3063\u3061\u3083\u3044\u3082\u306e\u304f\u3089\u3076\uff0d\u8d85\u5c0f\u578b\u30ae\u30a2\u30e2\u30fc\u30bf\u30fc<\/a><\/p>\n<p><strong>\u30ea\u30e2\u30b3\u30f3\u9001\u4fe1\u5074(iPhone-iOSC\u30a2\u30d7\u30ea)<\/strong><br \/>\nApple Store App\u306eiOSC\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<br \/>\niPhone\u3067\u64cd\u4f5c\u3059\u308biOSC\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30a2\u30d7\u30ea\u3067\u3059\u3002<br \/>\n\u64cd\u4f5c\u753b\u9762\u3092\u7528\u610f\u3055\u308c\u305f\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306e\u4e2d\u304b\u3089\u9078\u3073\u3001\u914d\u7f6e\u3055\u308c\u305f\u30dc\u30bf\u30f3\u3084\u30b9\u30e9\u30a4\u30c0\u3092\u64cd\u4f5c\u3057\u305f\u969b\u306b\u9001\u308a\u51fa\u3059\u30c7\u30fc\u30bf\u5f62\u5f0f\u3092\u8a2d\u5b9a\u3059\u308b\u3060\u3051\u3067\u4f7f\u3048\u307e\u3059\u3001\u64cd\u4f5c\u30c7\u30fc\u30bf\u306fUDP\u30d1\u30b1\u30c3\u30c8\u3068\u3057\u3066\u9001\u51fa\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/itunes.apple.com\/jp\/app\/iosc\/id303604578?mt=8\" target=\"_blank\" rel=\"noopener\">iPhone-iOSC\u30a2\u30d7\u30ea<\/a><\/p>\n<div id=\"attachment_455\" style=\"width: 310px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/goji2100.com\/blog\/wp-content\/uploads\/2015\/09\/IMG_1687.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-455\" class=\"size-medium wp-image-455\" src=\"https:\/\/goji2100.com\/blog\/wp-content\/uploads\/2015\/09\/IMG_1687-300x169.png\" alt=\"iOSC\u64cd\u4f5c\u6642\u753b\u9762\" width=\"300\" height=\"169\" srcset=\"http:\/\/goji2100.com\/blog\/wp-content\/uploads\/2015\/09\/IMG_1687-300x169.png 300w, http:\/\/goji2100.com\/blog\/wp-content\/uploads\/2015\/09\/IMG_1687-1024x577.png 1024w, http:\/\/goji2100.com\/blog\/wp-content\/uploads\/2015\/09\/IMG_1687.png 1136w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-455\" class=\"wp-caption-text\">iOSC\u64cd\u4f5c\u6642\u753b\u9762<\/p><\/div>\n<div id=\"attachment_485\" style=\"width: 310px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/goji2100.com\/blog\/wp-content\/uploads\/2015\/09\/IMG_1689.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-485\" class=\"size-medium wp-image-485\" src=\"https:\/\/goji2100.com\/blog\/wp-content\/uploads\/2015\/09\/IMG_1689-300x169.png\" alt=\"iOSC\u8a2d\u5b9a\u753b\u9762\u4f8b\" width=\"300\" height=\"169\" srcset=\"http:\/\/goji2100.com\/blog\/wp-content\/uploads\/2015\/09\/IMG_1689-300x169.png 300w, http:\/\/goji2100.com\/blog\/wp-content\/uploads\/2015\/09\/IMG_1689-1024x577.png 1024w, http:\/\/goji2100.com\/blog\/wp-content\/uploads\/2015\/09\/IMG_1689.png 1136w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-485\" class=\"wp-caption-text\">iOSC\u8a2d\u5b9a\u753b\u9762\u4f8b<\/p><\/div>\n<div id=\"attachment_456\" style=\"width: 310px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/goji2100.com\/blog\/wp-content\/uploads\/2015\/09\/IMG_1688.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-456\" class=\"size-medium wp-image-456\" src=\"https:\/\/goji2100.com\/blog\/wp-content\/uploads\/2015\/09\/IMG_1688-300x169.png\" alt=\"iOSC\u8a2d\u5b9a\u753b\u9762\u4f8b\" width=\"300\" height=\"169\" srcset=\"http:\/\/goji2100.com\/blog\/wp-content\/uploads\/2015\/09\/IMG_1688-300x169.png 300w, http:\/\/goji2100.com\/blog\/wp-content\/uploads\/2015\/09\/IMG_1688-1024x577.png 1024w, http:\/\/goji2100.com\/blog\/wp-content\/uploads\/2015\/09\/IMG_1688.png 1136w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-456\" class=\"wp-caption-text\">iOSC\u8a2d\u5b9a\u753b\u9762\u4f8b<\/p><\/div>\n<p>&nbsp;<\/p>\n<p><strong>iOSC\u304b\u3089\u9001\u51fa\u3055\u308c\u308bUDP\u30d1\u30b1\u30c3\u30c8\u306e\u5185\u5bb9<\/strong><\/p>\n<ul>\n<li>\u30d8\u30c3\u30c9\u30e9\u30a4\u30c8\uff08\u30dc\u30bf\u30f3\u3001\u30aa\u30eb\u30bf\u30cd\u30a4\u30c8\u52d5\u4f5c\uff09<br \/>\n\/osc\/Fxx,ixx0123<br \/>\n0123\u306f32bit\u30d0\u30a4\u30ca\u30ea\u5024\u30010:OFF\u30011:ON<\/li>\n<li>\u8b66\u7b1b\uff08\u30dc\u30bf\u30f3\uff09<br \/>\n\/osc\/Cxx,ixx0123<br \/>\n0123\u306f32bit\u30d0\u30a4\u30ca\u30ea\u5024\u30010:OFF\u30011:ON<\/li>\n<li>\u5de6\uff08\u30b9\u30e9\u30a4\u30c0\uff09<br \/>\n\/osc\/Lxx,ixx0123<br \/>\n0123\u306f32bit\u30d0\u30a4\u30ca\u30ea\u5024\u30010\uff5e127:\u5de6\u30b9\u30e9\u30a4\u30c0\u306e\u4f4d\u7f6e<\/li>\n<li>\u53f3\uff08\u30b9\u30e9\u30a4\u30c0\uff09<br \/>\n\/osc\/Rxx,ixx0123<br \/>\n0123\u306f32bit\u30d0\u30a4\u30ca\u30ea\u5024\u30010\uff5e127:\u53f3\u30b9\u30e9\u30a4\u30c0\u306e\u4f4d\u7f6e<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><strong>\u53d7\u4fe1\u6a5f\u5074\u56de\u8def\u56f3<\/strong><\/p>\n<div id=\"attachment_457\" style=\"width: 310px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/goji2100.com\/blog\/wp-content\/uploads\/2015\/09\/schematicsCar.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-457\" class=\"size-medium wp-image-457\" src=\"https:\/\/goji2100.com\/blog\/wp-content\/uploads\/2015\/09\/schematicsCar-300x232.png\" alt=\"ESP-WROOM-02 Wi-Fi\u30e9\u30b8\u30b3\u30f3\u30ab\u30fc\u56de\u8def\u56f3\" width=\"300\" height=\"232\" srcset=\"http:\/\/goji2100.com\/blog\/wp-content\/uploads\/2015\/09\/schematicsCar-300x232.png 300w, http:\/\/goji2100.com\/blog\/wp-content\/uploads\/2015\/09\/schematicsCar-1024x793.png 1024w, http:\/\/goji2100.com\/blog\/wp-content\/uploads\/2015\/09\/schematicsCar.png 1112w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-457\" class=\"wp-caption-text\">ESP-WROOM-02 Wi-Fi\u30e9\u30b8\u30b3\u30f3\u30ab\u30fc\u56de\u8def\u56f3<\/p><\/div>\n<p>&nbsp;<\/p>\n<p><strong>\u53d7\u4fe1\u6a5f\u5074\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9<\/strong><\/p>\n<pre class=\"lang:arduino decode:true \" title=\"ESP8266Car.ino\">#include &lt;ESP8266WiFi.h&gt;\r\n#include &lt;WiFiUdp.h&gt;\r\n\r\n#define LED_Light  2\r\n#define LED_Hone  15\r\n#define PWM_LF     4\r\n#define PWM_LR    12\r\n#define PWM_RF     5\r\n#define PWM_RR    13\r\n\r\nconst char ssid[] = \"ESPCar\";\r\nconst char pass[] = \"ESP8266ap\";\r\n\r\nWiFiUDP udp;\r\nunsigned int localPort = 10000;\r\nconst int OSC_PACKET_SIZE = 256;\r\nchar packetBuffer[OSC_PACKET_SIZE];\r\n\r\nvoid setup() {\r\n  Serial.begin(115200);\r\n  WiFi.softAP(ssid, pass);\r\n  IPAddress myIP = WiFi.softAPIP();\r\n  Serial.print(\"AP IP address: \");  Serial.println(myIP);\r\n\r\n  Serial.println(\"Starting UDP\");\r\n  udp.begin(localPort);\r\n  Serial.print(\"Local port: \");  Serial.println(udp.localPort());\r\n\r\n  pinMode(LED_Light, OUTPUT);\r\n  pinMode(LED_Hone , OUTPUT);\r\n  pinMode(PWM_LF   , OUTPUT);\r\n  pinMode(PWM_LR   , OUTPUT);\r\n  pinMode(PWM_RF   , OUTPUT);\r\n  pinMode(PWM_RR   , OUTPUT);\r\n  analogWrite(PWM_LF, 0);\r\n  analogWrite(PWM_LR, 0);\r\n  analogWrite(PWM_RF, 0);\r\n  analogWrite(PWM_RR, 0);\r\n}\r\n\r\nvoid loop() {\r\n  int rlen, NoData = 0;\r\n  int Val_L = 0, Val_R = 0, Val_F = 0, Val_C = 0;\r\n\r\n  while (1) {\r\n    if (!(rlen = udp.parsePacket())) {\r\n      if (++NoData &gt; 50) {\r\n        analogWrite(PWM_LF, 0); analogWrite(PWM_LR, 0);\r\n        analogWrite(PWM_RF, 0); analogWrite(PWM_RR, 0);\r\n      }\r\n      delay(10);\r\n      continue;\r\n    }\r\n\r\n    NoData = 0;\r\n    udp.read(packetBuffer, (rlen &gt; OSC_PACKET_SIZE) ? OSC_PACKET_SIZE : rlen);\r\n    if (strncmp(&amp;packetBuffer[0], \"\/osc\/\", 5) == 0) {\r\n      switch (packetBuffer[5]) {\r\n        case 'F':\r\n          Val_F = packetBuffer[15];\r\n          digitalWrite(LED_Light, Val_F);\r\n          break;\r\n        case 'C':\r\n          Val_C = packetBuffer[15];\r\n          analogWrite(LED_Hone, Val_C ? 512 : 0);\r\n          break;\r\n        case 'L':\r\n          analogWrite(PWM_LF, 0); analogWrite(PWM_LR, 0); \r\n          Val_L = packetBuffer[15];\r\n          if (Val_L &gt;=(64 - 8) &amp;&amp; Val_L &lt;= (64 + 8)) { Val_L = 64; }\r\n          if (Val_L &gt;= 64)\r\n                analogWrite(PWM_LF, (Val_L - 64) * 16);\r\n          else  analogWrite(PWM_LR, (63 - Val_L) * 16);\r\n          break;\r\n        case 'R':\r\n          analogWrite(PWM_RF, 0); analogWrite(PWM_RR, 0); \r\n          Val_R = packetBuffer[15];\r\n          if (Val_R &gt;=(64 - 8) &amp;&amp; Val_R &lt;= (64 + 8)) { Val_R = 64; }\r\n          if (Val_R &gt;= 64)\r\n                analogWrite(PWM_RF, (Val_R - 64) * 16);\r\n          else  analogWrite(PWM_RR, (63 - Val_R) * 16);\r\n          break;\r\n      }\r\n      Serial.printf(\"F=%d, C=%d, L=%4d, R=%4d\\n\", Val_F, Val_C, Val_L, Val_R);\r\n    }\r\n    delay(10);\r\n  }\r\n}\r\n<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b89\u4fa1\u306aWi-Fi\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u4f7f\u3063\u3066iPhone\u304b\u3089\u64cd\u4f5c\u3059\u308b\u30e9\u30b8\u30b3\u30f3\u30ab\u30fc\u3092\u4f5c\u308a\u307e\u3057\u305f\u3002 \u30ea\u30e2\u30b3\u30f3\u53d7\u4fe1\u5074(ESP-WROOM-02) \u53d7\u4fe1\u5074\u306fAP\u30e2\u30fc\u30c9\u3067\u52d5\u4f5c\u3057\u3001\u30a2\u30af\u30bb\u30b9\u30dd\u30a4\u30f3\u30c8\u7121\u3057\u3067iPhone\u3068\u76f4\u63a5\u63a5\u7d9a\u3057\u307e\u3059\u3002 \u5de6\u53f3\u306b\u30ae [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26,9,4,3],"tags":[27,28],"_links":{"self":[{"href":"http:\/\/goji2100.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/453"}],"collection":[{"href":"http:\/\/goji2100.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/goji2100.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/goji2100.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/goji2100.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=453"}],"version-history":[{"count":29,"href":"http:\/\/goji2100.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/453\/revisions"}],"predecessor-version":[{"id":482,"href":"http:\/\/goji2100.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/453\/revisions\/482"}],"wp:attachment":[{"href":"http:\/\/goji2100.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=453"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/goji2100.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=453"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/goji2100.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=453"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}