{"id":1695,"date":"2022-05-30T12:38:50","date_gmt":"2022-05-30T03:38:50","guid":{"rendered":"https:\/\/www.rocher.kyoto.jp\/arbr\/?p=1695"},"modified":"2022-05-30T12:38:50","modified_gmt":"2022-05-30T03:38:50","slug":"esp-now%e3%81%ae%e5%85%ac%e5%bc%8f%e3%82%b5%e3%83%b3%e3%83%97%e3%83%ab%e3%81%8c%e5%8b%95%e3%81%8b%e3%81%aa%e3%81%8b%e3%81%a3%e3%81%9f%e3%81%ae%e3%81%a7%e8%aa%bf%e6%9f%bb","status":"publish","type":"post","link":"https:\/\/www.rocher.kyoto.jp\/arbr\/?p=1695","title":{"rendered":"ESP-Now\u306e\u516c\u5f0f\u30b5\u30f3\u30d7\u30eb\u304c\u52d5\u304b\u306a\u304b\u3063\u305f\u306e\u3067\u8abf\u67fb"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u74b0\u5883<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>ESP32-DevKitC V4\u00a0\u00d7 2\u500b\uff08Master\u3068Slave\uff09<\/li><li>Arduino IDE (Windows Store 1.8.57.0)<\/li><li>\u30dc\u30fc\u30c9 ESP32 Dev Module(ESP32 Espressif Systems  v 1.0.6)<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">\u4f7f\u7528\u30b5\u30f3\u30d7\u30eb<\/h2>\n\n\n\n<p>ESP32 Dev Module\u306e\u300c\u30b9\u30b1\u30c3\u30c1\u4f8b\u300d->\u300cESP32\u300d->\u300cESPNow\u300d->\u300cBasic\u300d\u306eMaster\/Slave\u306e\u30bb\u30c3\u30c8<\/p>\n\n\n\n<p>\\ArduinoData\\packages\\esp32\\hardware\\esp32\\1.0.6\\libraries\\ESP32\\examples\\ESPNow\\Basic \u306e Master\u3068Slave<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u767a\u751f\u30a8\u30e9\u30fc<\/h2>\n\n\n\n<p>Slave\u306epeer\u306b\u30c7\u30fc\u30bf\u3092\u9001\u308b\u30bf\u30a4\u30df\u30f3\u30b0\uff08esp_now_send\uff09\u3067\u300c\u9055\u3046\u30c1\u30e3\u30f3\u30cd\u30eb\u306b\u306f\u9001\u308c\u306a\u3044\u3088\uff01\u300d\u3068\u6012\u3089\u308c\u308b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>E (838684) ESPNOW: Peer channel is not equal to the home channel, send fail!<br>Send Status: Invalid Argument<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u539f\u56e0<\/h2>\n\n\n\n<p>\u6587\u5b57\u901a\u308a\u9055\u3046\u30c1\u30e3\u30f3\u30cd\u30eb\u306b\u306f\u9001\u308c\u306a\u3044\u307f\u305f\u3044\u3002<a href=\"https:\/\/docs.espressif.com\/projects\/esp-idf\/en\/latest\/esp32\/api-reference\/network\/esp_now.html\">\u516c\u5f0f\u30b5\u30a4\u30c8<\/a>\u306b\u306a\u3093\u3068\u306a\u304f\u305d\u308c\u3092\u524d\u63d0\u3068\u3057\u3066\u3044\u305d\u3046\u306a\u3053\u3068\u306f\u66f8\u3044\u3066\u3042\u308b\u3051\u3069\u660e\u793a\u3057\u3066\u3042\u308b\u7b87\u6240\u306f\u898b\u3064\u3051\u3066\u3044\u306a\u3044\u3002\uff08\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u305d\u306e\u307e\u307e\u306a\u306e\u3067\u307e\u3041\u9593\u9055\u3044\u306f\u306a\u3044\u3093\u3060\u308d\u3046\u3002\uff09<a href=\"https:\/\/esp32.com\/viewtopic.php?t=18291\">\u3053\u3053\u3089<\/a>\u307f\u308b\u30682020\u5e74\u306e\u51ac\u3050\u3089\u3044\u306e1.0.5-rc2\u3067\u5909\u308f\u3063\u305f\u306e\u304b\u306a\uff1f<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>For example, the destination device doesn\u2019t exist; the channels of the devices are not the same<\/code><\/pre>\n\n\n\n<p>Master\u306f\u81ea\u5206\u304cDefault\u306e1\u30c1\u30e3\u30f3\u30cd\u30eb\u306b\u306a\u3063\u3066\u3044\u3066\u9001\u4fe1\u60f3\u5b9a\u304c3\u30c1\u30e3\u30f3\u30cd\u30eb\u306b\u306a\u3063\u3066\u3044\u308b\u306e\u3067\u5f15\u3063\u304b\u304b\u3063\u3066\u3044\u308b\u3002\uff08\u305d\u308c\u306f\u305d\u308c\u3068\u3057\u3066\u30b5\u30f3\u30d7\u30eb\u306eSlave\u306f\u30c1\u30e3\u30f3\u30cd\u30eb\u304c1\u306b\u306a\u3063\u3066\u3044\u308b\u306e\u306bMaster\u306e\u30bd\u30fc\u30b9\u3067\u306f3\u3092\u6307\u5b9a\u3057\u3066\u3044\u308b\u306e\u3067\u305d\u3053\u3067\u3082\u4e0d\u6574\u5408\u304c\u751f\u3058\u3066\u3044\u308b\uff09<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u5bfe\u51e6<\/h2>\n\n\n\n<p>\u30c1\u30e3\u30f3\u30cd\u30eb\u3092\u5408\u308f\u305b\u308c\u3070\u3088\u3044\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1ch\u3067\u4e0a\u3052\u308b\u5834\u5408<\/h3>\n\n\n\n<p>Slave\u306f1\u30c1\u30e3\u30f3\u30cd\u30eb\u3067\u4e0a\u304c\u3063\u3066\u3044\u308b\u306e\u3067\u3001\u9001\u4fe1\u60f3\u5b9a\u30921\u306b\u3057\u3066\u3084\u308c\u3070\u3088\u3044<\/p>\n\n\n\n<p>define CHANNEL 1<\/p>\n\n\n\n<p>slave.channel = CHANNEL;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u305d\u306e\u4ed6\u30c1\u30e3\u30f3\u30cd\u30eb\u3067\u4e0a\u3052\u308b\u5834\u5408<\/h3>\n\n\n\n<p>Master\/Slave\u306e\u30c1\u30e3\u30f3\u30cd\u30eb\u3092\u4efb\u610f(\u4f7f\u7528\u53ef\u80fd\u306f1\uff5e13)\u306b\u6307\u5b9a\u3057\u3066\u3084\u308c\u3070\u3088\u3044\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Slave(AP\u30e2\u30fc\u30c9)\u306e\u30c1\u30e3\u30f3\u30cd\u30eb\u6307\u5b9a<\/h4>\n\n\n\n<p>Slave\u306f\uff08\u9055\u548c\u611f\u3042\u308b\u3051\u3069\uff09AP\u30e2\u30fc\u30c9\u306b\u306a\u3063\u3066\u3044\u3066SoftAP\u7acb\u3061\u4e0a\u3052\u306e\u969b\u306b\u6307\u5b9a\u3067\u304d\u308b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>define CHANNEL 1 \/\/ \u304b\u3089\u306e\n bool result = WiFi.softAP(SSID, \"Slave_1_Password\", CHANNEL, 0);<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Master\uff08STA\u30e2\u30fc\u30c9\uff09\u306e\u30c1\u30e3\u30f3\u30cd\u30eb\u6307\u5b9a<\/h4>\n\n\n\n<p>Master\u306fSTA\u30e2\u30fc\u30c9\u306b\u306a\u3063\u3066\u308b\u3002<a href=\"https:\/\/docs.espressif.com\/projects\/esp-idf\/en\/v4.4.1\/esp32s2\/api-reference\/network\/esp_wifi.html\">\u3053\u3053<\/a>\u3092\u307f\u308b\u3068STA\u30e2\u30fc\u30c9\u306e\u3068\u304d\u306fsoft-AP\u3082station\u30e2\u30fc\u30c9\u3068\u4e00\u81f4\u3059\u308b\u3089\u3057\u3044\u3002\uff08\u3067\u3002\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3067\u78ba\u8a8d\u3067\u304d\u3066\u3044\u306a\u3044\u3051\u3069ESPNow\u3082soft-AP\u306e\u8a2d\u5b9a\u4f7f\u3063\u3066\u52d5\u3044\u3066\u3044\u308b\u307f\u305f\u3044\u3002Espressif \u3060\u3068\u30bd\u30fc\u30b9\u898b\u308c\u306a\u3044\u307f\u305f\u3044\u3060\u3051\u3069M5Stack\u306e\u65b9\u3067\u306f\u6d3e\u751f\u3057\u305f\u3082\u306e\uff1f\u307f\u308c\u308b\u3088\u3046\u306a\u306e\u3067\u305d\u3063\u3061\u8ffd\u3048\u3070\u308f\u304b\u308b\u304b\u3082\uff09<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>3. ESP32 is limited to only one channel, so when in the soft-AP+station mode, the soft-AP will adjust its channel automatically to be the same as the channel of the ESP32 station.<\/code><\/pre>\n\n\n\n<p>\u6307\u5b9a\u65b9\u6cd5\u306e\u6b63\u3057\u3044\u4f5c\u6cd5\u306f\u308f\u304b\u3089\u306a\u304b\u3063\u305f\u3002\u52d5\u3044\u305f\u306e\u306f\u4ee5\u4e0b\u306e\u64cd\u4f5c\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;esp_wifi.h>\/\/ \u3057\u3066\n\nvoid setup() {\r \/\/\u306e\n  WiFi.mode(WIFI_STA);\r \/\/ \u3057\u305f\u5f8c\u306b\n  esp_wifi_set_channel(CHANNEL, WIFI_SECOND_CHAN_NONE); \/\/ \u30c1\u30e3\u30f3\u30cd\u30eb\u3092\u6307\u5b9a\u3057\u3066\u3042\u3052\u308b<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u305d\u306e\u4ed6<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">\u30c1\u30e3\u30f3\u30cd\u30eb\u306b\u3064\u3044\u3066<\/h3>\n\n\n\n<p>2.4 GHz \u5e2f\u306e\u4e2d\u3067\u5fae\u5999\u306b\u5468\u6ce2\u6570\u5909\u3048\u3066\u5468\u6ce2\u6570\u3054\u3068\u306b\u30c7\u30fc\u30bf\u9001\u308b\u3084\u3064\u3002<a href=\"https:\/\/www.silex.jp\/blog\/wireless\/2011\/05\/lan1.html\">\u3053\u3053<\/a>\u3068\u304b\u308f\u304b\u308a\u3084\u3059\u3044\u3002\u65e5\u672c\u3060\u30681-13\u30c1\u30e3\u30f3\u30cd\u30eb\u4f7f\u3048\u3066ESP\u30821-13\u6307\u5b9a\u3067\u304d\u308b\u3002\uff08\u591a\u5206\u540c\u3058\u5974\u3060\u3068\u601d\u3046\u3051\u3069\u8abf\u3079\u3066\u306a\u3044\uff09\u30c1\u30e3\u30f3\u30cd\u30eb\u8fd1\u3044\u3068\u5e72\u6e09\u3059\u308b\u306e\u3067\u3001\u65e2\u5b58\u306e\u6a5f\u5668\u3068\u91cd\u306a\u3063\u305f\u308a\u3057\u305f\u3089\u5909\u3048\u3066\u307f\u308b\u3068\u5e78\u305b\u304b\u3082\u3057\u308c\u306a\u3044\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">\u5c11\u3057\u4e0a\u306eWIFI_SECOND_CHAN_NONE\u306b\u3064\u3044\u3066<\/h4>\n\n\n\n<p>\u300c\u30c1\u30e3\u30f3\u30cd\u30eb\uff12\u3064\u4f7f\u3046\u3068\u30c7\u30fc\u30bf\u304c\u500d\u306e\u52e2\u3044\u3067\u9001\u53d7\u4fe1\u3067\u304d\u308b\u300d\u3063\u3066\u3084\u3064\u3092\u4f7f\u3046\u304b\u3069\u3046\u304b\u306e\u9078\u629e\u30d1\u30e9\u30e1\u30fc\u30bf\u3067\u4f7f\u308f\u306a\u3044\uff08HT20\uff09\u3092\u6307\u5b9a\u3057\u3066\u3044\u308b\u3002\u4f7f\u3046(HT40)\u6307\u5b9a\u306eWIFI_SECOND_CHAN_ABOVE\u3068WIFI_SECOND_CHAN_BELOW\u3082\u3042\u308b\u3051\u3069ESPNow\u306b\u306f\u591a\u5206\u53cd\u6620\u3055\u308c\u306a\u3044\u3067Wifi\u306e\u65b9\u3060\u3051\u306b\u304b\u304b\u308f\u308b\u3068\u601d\u3046\u3002\uff08\u3068\u308a\u3042\u3048\u305a\u901f\u3055\u3044\u3089\u3093\u3068\u601d\u3046\u306e\u3067\u3061\u3083\u3093\u3068\u8abf\u3079\u3066\u306f\u3044\u306a\u3044\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u74b0\u5883 ESP32-DevKitC V4\u00a0\u00d7 2\u500b\uff08Master\u3068Slave\uff09 Arduino IDE (Windows Store 1.8.57.0) \u30dc\u30fc\u30c9 ESP32 Dev Module(ESP32 Espress [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[117],"tags":[123,124],"class_list":["post-1695","post","type-post","status-publish","format-standard","hentry","category-117","tag-esp","tag-espnow"],"_links":{"self":[{"href":"https:\/\/www.rocher.kyoto.jp\/arbr\/index.php?rest_route=\/wp\/v2\/posts\/1695","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rocher.kyoto.jp\/arbr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rocher.kyoto.jp\/arbr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rocher.kyoto.jp\/arbr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rocher.kyoto.jp\/arbr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1695"}],"version-history":[{"count":3,"href":"https:\/\/www.rocher.kyoto.jp\/arbr\/index.php?rest_route=\/wp\/v2\/posts\/1695\/revisions"}],"predecessor-version":[{"id":1698,"href":"https:\/\/www.rocher.kyoto.jp\/arbr\/index.php?rest_route=\/wp\/v2\/posts\/1695\/revisions\/1698"}],"wp:attachment":[{"href":"https:\/\/www.rocher.kyoto.jp\/arbr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1695"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rocher.kyoto.jp\/arbr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1695"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rocher.kyoto.jp\/arbr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1695"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}