
{"id":7167,"date":"2018-05-02T19:07:43","date_gmt":"2018-05-02T10:07:43","guid":{"rendered":"https:\/\/okiraku-camera.tokyo\/blog\/?p=7167"},"modified":"2018-05-18T18:04:17","modified_gmt":"2018-05-18T09:04:17","slug":"esp8266%e3%81%a8esp32-%e6%b8%a9%e5%ba%a6%e6%b8%ac%e5%ae%9a%e3%81%abesp-now%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b","status":"publish","type":"post","link":"https:\/\/okiraku-camera.tokyo\/blog\/?p=7167","title":{"rendered":"ESP8266\u3068ESP32 \u6e29\u5ea6\u6e2c\u5b9a\u306bESP-NOW\u3092\u4f7f\u3063\u3066\u307f\u308b"},"content":{"rendered":"<h1>\u6982\u8981<\/h1>\n<p>Espressif\u793e\u304c\u958b\u767a\u3057\u305fESP-NOW\u306f\u3001IEEE802.11\u306eMAC\u30d5\u30ec\u30fc\u30e0\u306e\u4e00\u7a2e\u3067\u3042\u308b\u30a2\u30af\u30b7\u30e7\u30f3\u30d5\u30ec\u30fc\u30e0\u3092\u4f7f\u3063\u3066Espressif\u793e\u306eWiFi\u30c7\u30d0\u30a4\u30b9\u9593\u3067\u30c7\u30fc\u30bf\u3092\u9001\u53d7\u4fe1\u3059\u308b\u305f\u3081\u306e\u72ec\u81ea\u6280\u8853\u3067\u3001ESP-WROOM-02(ESP8266EX)\u3084ESP-WROOM-32(ESP32)\u9593\u3067\u4f7f\u3046\u3053\u3068\u304c\u3067\u304d\u308b\u3002\u3075\u3064\u3046\u306eWiFi\u306e\u30b9\u30c6\u30fc\u30b7\u30e7\u30f3\u30fc\u30a2\u30af\u30bb\u30b9\u30dd\u30a4\u30f3\u30c8\u9593\u306e\u63a5\u7d9a\u78ba\u7acb\u3084IP\u30a2\u30c9\u30ec\u30b9\u306e\u53d6\u5f97\u3084\u8a2d\u5b9a\u3082\u306a\u3044\u304b\u3089\u3001\u4f59\u8a08\u306a\u6642\u9593\u3092\u304b\u3051\u305a\u306b\u30c7\u30fc\u30bf\u306e\u9001\u4fe1\u304c\u3067\u304d\u308b\u3002<\/p>\n<p>\u4e00\u56de\u306b\u3064\u304d250\u30d0\u30a4\u30c8\u4ee5\u5185\u306e\u30c7\u30fc\u30bf\u3057\u304b\u9001\u4fe1\u3067\u304d\u306a\u3044\u304c\u3001\u6e29\u5ea6\u30bb\u30f3\u30b5\u30fc\u306e\u6e2c\u5b9a\u5024\u3092\u9001\u308b\u306b\u306f\u5341\u5206\u3060\u308d\u3046\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u5c4b\u5916\u3084\u5ba4\u5185\u3067\u4f7f\u3063\u3066\u3044\u308bWROOM-02 + \u6e29\u5ea6\u30bb\u30f3\u30b5\u30fc\u306e\u96fb\u6c60\u306e\u30e2\u30c1\u3092\u3088\u304f\u3059\u308b\u305f\u3081\u3001ESP-NOW\u3092\u4f7f\u3063\u3066\u307f\u308b\u3053\u3068\u306b\u3057\u305f\u3002\u4f7f\u3044\u65b9\u3082\u7c21\u5358\u3067\u6709\u52b9\u6027\u3082\u9ad8\u3044\u5370\u8c61\u3002<\/p>\n<h2>\u4eca\u56de\u306e\u5b9f\u88c5\u306b\u3064\u3044\u3066<\/h2>\n<p>4\u53f0\u306eESP-WROOM-02(D) + \u6e29\u5ea6\u30bb\u30f3\u30b5\u30fc\u306e\u30dc\u30fc\u30c9\u3092\u9001\u4fe1\u5074\u30011\u53f0\u306eESP-WROOM-32\u3092\u53d7\u4fe1\u5074\u3068\u3057\u305f\u3002<\/p>\n<pre class=\"nums:false lang:default decode:true\">                esp-now \r\n                transmission\r\nCtrl1(esp8266) --------+\r\n                       |     ESP-32  \r\nCtrl2(esp8266) --------+---&gt; (Slave) &lt;---&gt;  WiFi Router &lt;---&gt; internet\r\n                       |             (&lt;--- (tcp connection) --&gt; httpd)\r\nCtrl3(esp8266) --------+\r\nCtrl4(esp8266) --------+\r\n...\r\n\r\n<\/pre>\n<p>ESP-NOW\u306e\u4e16\u754c\u3067\u306f\u3001\u304a\u3082\u306b\u9001\u4fe1\u3092\u884c\u3046\u5074\u3092\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u3001\u53d7\u4fe1\u5074\u3092\u30b9\u30ec\u30fc\u30d6\u3068\u79f0\u3059\u308b\u3002<\/p>\n<figure id=\"attachment_7192\" aria-describedby=\"caption-attachment-7192\" style=\"width: 552px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/okiraku-camera.tokyo\/blog\/wp-content\/uploads\/2018\/05\/ec6dbae5a579d7ee9b801d867bd7c66f.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-large wp-image-7192\" src=\"https:\/\/okiraku-camera.tokyo\/blog\/wp-content\/uploads\/2018\/05\/ec6dbae5a579d7ee9b801d867bd7c66f-552x414.jpg\" alt=\"ESP32\u3068ESP8266\" width=\"552\" height=\"414\" \/><\/a><figcaption id=\"caption-attachment-7192\" class=\"wp-caption-text\">ESP-WROOM-32\u3068ESP-WROOM-02D\u3002\u30de\u30af\u30ed\u3067\u5199\u3059\u3068\u554f\u984c\u3092\u611f\u3058\u308b\u307b\u3069\u30db\u30b3\u30ea\u304c\u6e9c\u307e\u3063\u3066\u308b\u306e\u304c\u898b\u3048\u3066\u3057\u307e\u3046\u3002<\/figcaption><\/figure>\n<p>\u4eca\u56de\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u4f5c\u3063\u305f\u3002<\/p>\n<ul>\n<li>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u5074\u306f\u6e2c\u5b9a\u9593\u9694\u3054\u3068\u306b\u30c7\u30a3\u30fc\u30d7\u30b9\u30ea\u30fc\u30d7\u304b\u3089\u5fa9\u5e30\u3057\u3066\u6e2c\u5b9a\u304a\u3088\u3073\u30c7\u30fc\u30bf\u9001\u4fe1\u3092\u884c\u3046\u3002\u30b9\u30ea\u30fc\u30d7<span style=\"text-decoration: underline;\">\u5fa9\u5e30\u304b\u3089\u9001\u4fe1\u5b8c\u4e86\u3057\u3066\u518d\u5ea6\u30b9\u30ea\u30fc\u30d7\u3059\u308b\u307e\u3067\u306e\u6240\u7528\u6642\u9593\u306f\u7d0420\uff5e30msec\u7a0b\u5ea6<\/span>\u3002\u901a\u5e38\u306eWiFi\u63a5\u7d9a\u6642\u306e1\/100\u4ee5\u4e0b\u3067\u3042\u308b\u3002<\/li>\n<li>\u53d7\u4fe1\u5074\u306f\u30c7\u30fc\u30bf\u53d7\u4fe1\u90fd\u5ea6\u3054\u3068\u306b\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u63a5\u7d9a\u7528\u306eWiFi\u30eb\u30fc\u30bf\u30fc\u306b\u666e\u901a\u306b\u63a5\u7d9a\u3057\u3066Web\u30b5\u30fc\u30d0\u30fc\u306bGET\u30ea\u30af\u30a8\u30b9\u30c8\u3067\u30c7\u30fc\u30bf\u3092\u9001\u308b\u3002\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u53d7\u3051\u305fWeb\u30b5\u30fc\u30d0\u30fc\u306f\u5f93\u6765\u3068\u304a\u308a\u306bMySQL\u306b\u30c7\u30fc\u30bf\u3092\u683c\u7d0d\u3059\u308b\u3002\u3053\u3061\u3089\u306f\u53d7\u4fe1\u5b8c\u4e86\u304b\u3089http\u30ea\u30af\u30a8\u30b9\u30c8\u307e\u3067\u306b3.5\u79d2\u9593\u307b\u3069\u304b\u304b\u3063\u3066\u3057\u307e\u3046\u3002<\/li>\n<\/ul>\n<p>\u8cc7\u6599\u3092\u8aad\u3093\u3060\u308a\u5b9f\u969b\u306b\u4f7f\u3063\u3066\u307f\u3066\u30dd\u30a4\u30f3\u30c8\u3068\u611f\u3058\u305f\u3053\u3068\u306f\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3002<\/p>\n<ul>\n<li>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u5074API\u3067\u30c7\u30fc\u30bf\u9001\u4fe1\u306e\u6210\u529f\uff0f\u5931\u6557\u3092\u691c\u51fa\u3067\u304d\u308b\u3002<br \/>\n\u9001\u4fe1\u3057\u305fMAC\u30d5\u30ec\u30fc\u30e0\u306b\u5bfe\u3059\u308bACK\u304c\u5f97\u3089\u308c\u306a\u3051\u308c\u3070\u5931\u6557\u306b\u306a\u308b\u3088\u3046\u3060\u3002\u9001\u4fe1\u6210\u529f\u30b9\u30c6\u30fc\u30bf\u30b9\u304c\u5f97\u3089\u308c\u305f\u3068\u304d\u306f\u3001\u30b9\u30ec\u30fc\u30d6\u306b\u5c4a\u3044\u3066\u3044\u308b\u3068\u8003\u3048\u3066\u826f\u3055\u305d\u3046\u3002<\/li>\n<li>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u5074API\u3067\u306f\u9001\u4fe1\u5931\u6557\u306e\u7406\u7531\u3092\u691c\u51fa\u3067\u304d\u306a\u3044\u3002<br \/>\n\u4ed6\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u3068\u9001\u4fe1\u30bf\u30a4\u30df\u30f3\u30b0\u304c\u91cd\u8907\u3057\u305f\u3068\u304d\u3084\u3001\u30b9\u30ec\u30fc\u30d6\u5074\u304c\u5f85\u3061\u53d7\u3051\u3066\u3044\u306a\u3044\u5834\u5408\u306a\u3069\u306b\u5931\u6557\u3059\u308b\u304c\u3001\u305d\u306e\u7406\u7531\u306fAPI\u304b\u3089\u306f\u308f\u304b\u3089\u306a\u3044\u3002\u5931\u6557\u6642\u306b\u306f\u30b9\u30b1\u30c3\u30c1\u3067\u518d\u9001\u3059\u308b\u3053\u3068\u306b\u306a\u308b\u304c\u3001\u4ed6\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u3068\u9001\u4fe1\u30bf\u30a4\u30df\u30f3\u30b0\u3092\u5909\u3048\u306a\u3051\u308c\u3070\u5931\u6557\u3092\u7e70\u308a\u8fd4\u3059\u3060\u308d\u3046\u3002<\/li>\n<li>\u9001\u4fe1\u5931\u6557\u3092\u691c\u51fa\u3057\u3066\u3082\u3001\u30b9\u30ec\u30fc\u30d6\u5074\u3067\u6b63\u3057\u304f\u53d7\u4fe1\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u304c\u3042\u308b\u3002<br \/>\n\u5931\u6557\u3092\u691c\u51fa\u3057\u305f\u5834\u5408\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u5074\u306f\u518d\u9001\u3059\u308b\u3057\u304b\u306a\u3044\u3002\u3057\u304b\u3057\u306a\u304c\u3089\u518d\u9001\u524d\u306e\u30c7\u30fc\u30bf\u304c\u6b63\u3057\u304f\u53d7\u4fe1\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u304c\u3042\u308b\u3002\u518d\u9001\u3057\u305f\u30c7\u30fc\u30bf\u3082\u6b63\u3057\u304f\u53d7\u4fe1\u3055\u308c\u308c\u3070\u540c\u30bf\u30a4\u30df\u30f3\u30b0\u3067\u306e\u91cd\u8907\u30c7\u30fc\u30bf\u3068\u306a\u308b\u3002\u91cd\u8907\u304c\u751f\u3058\u305f\u3053\u3068\u3092\u691c\u51fa\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u3066\u304a\u304f\u3002<\/li>\n<li>\u30b9\u30ec\u30fc\u30d6\u5074\u3067\u30c7\u30fc\u30bf\u306e\u6709\u52b9\u6027\u3092\u30c1\u30a7\u30c3\u30af\u3059\u308b\u3002<br \/>\n\u53d7\u4fe1\u6210\u529f\u4ee5\u5916\u306f\u691c\u51fa\u3067\u304d\u306a\u3044\u306e\u3067\u3001\u4e00\u5fdc\u30c7\u30fc\u30bf\u9577\u3001\u304a\u3088\u3073\u3001\u30c1\u30a7\u30c3\u30af\u30b5\u30e0\u3084CRC\u306b\u3088\u3063\u3066\u30c7\u30fc\u30bf\u304c\u6709\u52b9\u3067\u3042\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3059\u308b\u3053\u3068\u306b\u3059\u308b\u3002<\/li>\n<li>API(WiFi\u30af\u30e9\u30b9)\u306b\u4e0e\u3048\u308bWiFi\u30c1\u30e3\u30cd\u30eb\u306f\u3068\u3082\u306b0\u3092\u6307\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b(\u306a\u3093\u3067\u304b\u5206\u304b\u3089\u306a\u3044)\u3002\u8a66\u3057\u3066\u307f\u305f\u304c\u30010\u4ee5\u5916\u306f\u901a\u3089\u306a\u304b\u3063\u305f\u3002<\/li>\n<\/ul>\n<p><a href=\"\/blog\/?page_id=7178\" target=\"_blank\" rel=\"noopener\">\u4eca\u56de\u4f5c\u6210\u3057\u305f\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u5074\u304a\u3088\u3073\u30b9\u30ec\u30fc\u30d6\u5074\u306e\u30b9\u30b1\u30c3\u30c1\u306a\u3069\u306f\u3053\u3061\u3089\u306e\u30da\u30fc\u30b8<\/a>\u306b\u63b2\u8f09\u3057\u305f\u3002<\/p>\n<p>ESP-NOW\u95a2\u4fc2\u306e\u8cc7\u6599\u306f\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3002<\/p>\n<ul>\n<li><a href=\"https:\/\/www.espressif.com\/sites\/default\/files\/documentation\/esp-now_user_guide_en.pdf\">ESP-NOW User Guide<\/a><br \/>\n\u516c\u5f0f\u30ac\u30a4\u30c9\u3002<\/li>\n<li><a href=\"http:\/\/esp-idf.readthedocs.io\/en\/latest\/api-reference\/wifi\/esp_now.html\">Docs \u00bb API Reference \u00bb Wi-Fi API \u00bb ESP-NOW<\/a><br \/>\nESP32\u7528\u306eAPI\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9\u3002MAC\u30d5\u30ec\u30fc\u30e0\u306e\u69cb\u6210\u56f3\u306a\u3069\u3082\u542b\u307e\u308c\u3066\u3044\u308b\u3002<\/li>\n<li><a href=\"https:\/\/www.espressif.com\/sites\/default\/files\/documentation\/2c-esp8266_non_os_sdk_api_reference_en.pdf\">ESP8266 Non-OS SDK API Reference<\/a> (version2.2)<br \/>\nESP8266\u7528\u306eAPI\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9<\/li>\n<li>\u5b9f\u88c5\u4f8b\u3068\u3057\u3066\u3001\u300c<a class=\"bookmark\" href=\"https:\/\/lowreal.net\/2016\/01\/14\/2\" rel=\"bookmark\">ESP8266 \u306e\u4f4e\u6d88\u8cbb\u96fb\u529b\u306e\u9650\u754c\u3092\u3055\u3050\u308b (ESP-NOW\u3092\u4f7f\u3063\u3066\u307f\u308b)<\/a>\u300d\u3092\u53c2\u8003\u306b\u3055\u305b\u3066\u3044\u305f\u3060\u3044\u305f\u3002<\/li>\n<\/ul>\n<p>\u306a\u304a\u73fe\u6bb5\u968e(2018\u5e745\u6708)\u3067\u306f\u3001ESP8266\u7528\u3068ESP32\u7528\u3068\u3067\u30a4\u30f3\u30af\u30eb\u30fc\u30c9\u3059\u3079\u304d\u30d8\u30c3\u30c0\u30d5\u30a1\u30a4\u30eb\u540d\u304c\u7570\u306a\u3063\u3066\u3044\u308b\u3057\u3001API\u95a2\u6570\u3082\u82e5\u5e72\u7570\u306a\u3063\u3066\u3044\u308b\u3002<br \/>\nESP8266\u7528\u306f <em>#include &lt;espnow.h&gt;<\/em> \u3060\u304c\u3001ESP32\u7528\u3067\u306f<em>#include &lt;esp_now.h&gt;<\/em> \u3068\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u3057\u30018266\u306b\u3042\u3063\u306632\u306b\u306f \u5b58\u5728\u3057\u306a\u3044API\u95a2\u6570\u3082\u3042\u3063\u305f\u3002<\/p>\n<h2>\u30b9\u30ec\u30fc\u30d6\u5074\u306e\u69cb\u6210\u6982\u8981<\/h2>\n<p>\u30b9\u30ec\u30fc\u30d6\u5074\u306f\u3001WROOM-02\u304c\u4f59\u3063\u3066\u306a\u304b\u3063\u305f\u306e\u3067ESP32 DevKit-C(<a href=\"http:\/\/akizukidenshi.com\/catalog\/g\/gM-11819\/\">\u79cb\u6708\u96fb\u5b50\u306eESP-WROOM-32\u958b\u767a\u30dc\u30fc\u30c9<\/a>)\u3092\u3075\u3064\u3046\u306e\u30d6\u30ec\u30c3\u30c9\u30dc\u30fc\u30c9\u306b\u8f09\u305b\u3001WiFi\u63a5\u7d9a\u6642\u306b\u70b9\u706f\u3059\u308b\u30a4\u30f3\u30b8\u30b1\u30fc\u30bf\u30fc\u7528\u3068\u3057\u3066LED\u30921\u3064\u8ffd\u52a0\u3057\u3066\u4f7f\u3063\u305f\u3002GPIO13\u304b\u30892K\u03a9\u306e\u62b5\u6297\u3092\u4ecb\u3057\u3066LED\u306e\u30a2\u30ce\u30fc\u30c9\u306b\u63a5\u7d9a\u3057\u30ab\u30bd\u30fc\u30c9\u5074\u306fGND\u306b\u63a5\u7d9a\u3002<\/p>\n<figure id=\"attachment_7193\" aria-describedby=\"caption-attachment-7193\" style=\"width: 552px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/okiraku-camera.tokyo\/blog\/wp-content\/uploads\/2018\/05\/343778d66e0113a87d8037b106505380.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-large wp-image-7193\" src=\"https:\/\/okiraku-camera.tokyo\/blog\/wp-content\/uploads\/2018\/05\/343778d66e0113a87d8037b106505380-552x414.jpg\" alt=\"ESP32-DevC\" width=\"552\" height=\"414\" \/><\/a><figcaption id=\"caption-attachment-7193\" class=\"wp-caption-text\">ESP32-DevKit-C<\/figcaption><\/figure>\n<p>\u96fb\u6e90\u306f\u3001\u30dc\u30fc\u30c9\u4e0a\u306eUSB\u30de\u30a4\u30af\u30ed-B\u306b\u30b9\u30de\u30db\u5145\u96fb\u7528\u306eAC\u30a2\u30c0\u30d7\u30bf\u3092\u63a5\u7d9a\u3057\u305f\u3002\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u3068\u30b9\u30ec\u30fc\u30d6\u3092\u3042\u308f\u305b\u305f\u5168\u4f53\u306e\u6d88\u8cbb\u96fb\u529b\u306f\u5897\u3048\u308b\u3053\u3068\u306b\u306a\u308b\u304b\u3082\u3057\u308c\u306a\u3044\u304c\u3001\u30bb\u30f3\u30b5\u30fc\u5074\u306e\u96fb\u6c60\u304c\u9577\u6301\u3061\u3059\u308c\u3070\u305d\u308c\u3067\u3044\u3044\u3002<\/p>\n<h3>\u30b9\u30ec\u30fc\u30d6\u5074\u30b9\u30b1\u30c3\u30c1<\/h3>\n<p>\u30b9\u30ec\u30fc\u30d6\u5074\u306f\u3001ESP-NOW\u3067\u30c7\u30fc\u30bf\u3092\u5f85\u3061\u53d7\u3051\u7d9a\u3051\u308b\u3002\u305d\u3057\u3066\u53d7\u4fe1\u304c\u5b8c\u4e86\u3059\u308b\u305f\u3073\u3054\u3068\u306b\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u63a5\u7d9a\u7528\u306eWiFi\u30eb\u30fc\u30bf\u30fc\u306b\u63a5\u7d9a\u3057\u3001\u30c7\u30fc\u30bf\u3092\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u4e0a\u306eWEB\u30b5\u30fc\u30d0\u30fc\u306b\u6295\u3052\u308b\u3002\u5168\u4f53\u3057\u3066\u898b\u308b\u3068\u3001\u4eca\u307e\u3067WROOM-02 + \u6e29\u5ea6\u30bb\u30f3\u30b5\u30fc\u30dc\u30fc\u30c9\u304c\u5358\u72ec\u3067\u5b9f\u65bd\u3057\u3066\u3044\u305f\u51e6\u7406\u306e\u4e00\u90e8\u3092ESP32\u306b\u4ee3\u884c\u3057\u3066\u3082\u3089\u3046\u308f\u3051\u3067\u3042\u308b\u3002<\/p>\n<p>\u4ee5\u4e0b\u3001\u9806\u4e0d\u540c\u306b\u306a\u308b\u304c\u30c7\u30fc\u30bf\u69cb\u9020\u3068\u95a2\u6570\u306e\u52d5\u4f5c\u6982\u7565\u3092\u8a18\u3059<a href=\"\/blog\/?page_id=7178#1\" target=\"_blank\" rel=\"noopener\">\u3002\u30b9\u30b1\u30c3\u30c1\u81ea\u4f53\u306f\u5148\u306b\u8f09\u305b\u305f\u30da\u30fc\u30b8\u3092\u53c2\u7167<\/a>\u306e\u3053\u3068\u3002<\/p>\n<h6>\u9001\u53d7\u4fe1\u30c7\u30fc\u30bf\u69cb\u9020<\/h6>\n<p>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u3068\u30b9\u30ec\u30fc\u30d6\u306f\u4ee5\u4e0b\u306e\u69cb\u9020\u4f53\u30c7\u30fc\u30bf\u3092\u4f7f\u3063\u3066\u30c7\u30fc\u30bf\u3092\u3084\u308a\u53d6\u308a\u3059\u308b\u3002\u30d1\u30c3\u30af\u3057\u3066\u3044\u308b\u306e\u3067\u5927\u304d\u3055\u306f24\u30d0\u30a4\u30c8\u3002\u30d8\u30c3\u30c0\u30d5\u30a1\u30a4\u30eb\u306b\u51fa\u3057\u3066\u30e9\u30a4\u30d6\u30e9\u30ea\u3068\u3057\u3066\u30a4\u30f3\u30af\u30fc\u30eb\u30c9\u3057\u3088\u3046\u304b\u3068\u601d\u3063\u305f\u304c\u3001\u3068\u308a\u3042\u3048\u305a\u4e21\u65b9\u306e\u30b9\u30b1\u30c3\u30c1\u306b\u30d9\u30bf\u30c3\u3068\u66f8\u3044\u305f\u3002<\/p>\n<pre class=\"lang:default decode:true\">#pragma pack(push, 1)\r\ntypedef struct {\r\n  uint16_t seq_no;   \/\/ \u9001\u4fe1\u30b7\u30fc\u30b1\u30f3\u30b9\u756a\u53f7 0\uff5e\r\n  uint16_t elapsed;  \/\/ \u30b9\u30ea\u30fc\u30d7\u5fa9\u5e30\uff5e\u30b9\u30ea\u30fc\u30d7\u307e\u3067\u306e\u7d4c\u904e\u6642\u9593 (msec)\r\n  uint16_t extra;    \/\/ TBD\r\n  uint8_t retry;     \/\/ \u540c\u4e00\u30d5\u30ec\u30fc\u30e0\u9001\u4fe1\u30ea\u30c8\u30e9\u30a4\u6570 0\uff5e\r\n  float T;           \/\/ \u6e29\u5ea6\r\n  float H;           \/\/ \u76f8\u5bfe\u6e7f\u5ea6\r\n  float P;           \/\/ \u6c17\u5727\r\n  float V;           \/\/ \u96fb\u6e90\u96fb\u5727\r\n  uint8_t checksum;  \/\/ \u30c1\u30a7\u30c3\u30af\u30b5\u30e0\r\n} sensor_data_t;\r\n#pragma pack(pop)<\/pre>\n<p>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u5074\u3067\u306f\u3053\u306e\u69cb\u9020\u4f53\u30c7\u30fc\u30bf\u3092RTC\u30e1\u30e2\u30ea\u306b\u3082\u4fdd\u5b58\u3057\u3001\u30c7\u30a3\u30fc\u30d7\u30b9\u30ea\u30fc\u30d7\u3092\u307e\u305f\u3044\u3067\u30b7\u30fc\u30b1\u30f3\u30b9\u756a\u53f7\u3001\u524d\u56de\u9001\u4fe1\u6642\u306e\u6240\u7528\u6642\u9593\u3001\u30ea\u30c8\u30e9\u30a4\u56de\u6570\u306e\u7d2f\u7a4d\u306b\u4f7f\u3063\u3066\u3044\u308b\u3002<br \/>\n\u30b9\u30ec\u30fc\u30d6\u5074\u306f\u3001\u9001\u3089\u308c\u3066\u304d\u305f\u30ea\u30c8\u30e9\u30a4\u56de\u6570\u3084\u7d4c\u904e\u6642\u9593\u3092\u6e29\u5ea6\u306a\u3069\u306e\u6e2c\u5b9a\u5024\u3068\u3068\u3082\u306bWeb\u30b5\u30fc\u30d0\u30fc\u306b\u9001\u4fe1\u3059\u308b\u3002\u307e\u305f\u3001\u9001\u4fe1\u30b7\u30fc\u30b1\u30f3\u30b9\u756a\u53f7\u3092\u76f4\u524d\u306b\u53d7\u4fe1\u3057\u305f\u3082\u306e\u3068\u6bd4\u8f03\u3057\u540c\u3058\u9001\u4fe1\u6a5f\u4f1a\u306e\u30c7\u30fc\u30bf\u306e\u91cd\u8907\u3082\u30c1\u30a7\u30c3\u30af\u3059\u308b\u3002<\/p>\n<p>elapsed\u30d5\u30a3\u30fc\u30eb\u30c9\u306b\u306f\u3001\u524d\u56de(\u30b7\u30fc\u30b1\u30f3\u30b9\u756a\u53f7 &#8211; 1) \u306b\u304a\u3051\u308b\u3001\u30b9\u30ea\u30fc\u30d7\u5fa9\u5e30\uff5e\u9001\u4fe1\uff5e\u30b9\u30ea\u30fc\u30d7\u958b\u59cb\u76f4\u524d\u307e\u3067\u306b\u8981\u3057\u305f\u6642\u9593\u304cmsec\u5358\u4f4d\u3067\u683c\u7d0d\u3055\u308c\u3066\u3044\u308b\u3002\u3057\u305f\u304c\u3063\u3066\u521d\u56de\u9001\u4fe1\u6642(\u30ea\u30b9\u30bf\u30fc\u30c8\u76f4\u5f8c)\u306b\u306f0\u304c\u6765\u308b\u3002\u9001\u4fe1\u30ea\u30c8\u30e9\u30a4\u304c\u767a\u751f\u3057\u3066\u3044\u305f\u5834\u5408\u3001\u30ea\u30c8\u30e9\u30a4\u6642\u306b\u8981\u3057\u305f\u6642\u9593\u3082elapsed\u306b\u5408\u7b97\u3055\u308c\u308b\u306e\u3067\u3001\u3042\u308b\u30b7\u30fc\u30b1\u30f3\u30b9\u756a\u53f7\u306e\u30c7\u30fc\u30bf\u3092\u9001\u308b\u306e\u306b\u8981\u3057\u305fWiFi\u7a3c\u50cd\u6642\u9593\u304c\u5206\u304b\u308b\u3002<\/p>\n<h6>void start_espnow();<\/h6>\n<p>ESP-NOW\u306e\u30b9\u30ec\u30fc\u30d6\u5074\u3092\u958b\u59cb\u3059\u308b\u305f\u3081\u306e\u51e6\u7406\u3092\u884c\u3046\u3002\u307e\u305a<em>WiFi.mode(WIFI_AP);<\/em>\u3068<em>WiFi.softAP(ssid,\u00a0 &#8230;);<\/em> \u306b\u3088\u3063\u3066\u30bd\u30d5\u30c8AP\u30e2\u30fc\u30c9\u3092\u958b\u59cb\u3057\u3066\u304b\u3089\u00a0 <em>esp_now_init();<\/em> \u306b\u3088\u3063\u3066ESP-NOW\u306e\u4f7f\u7528\u3092\u5ba3\u8a00\u3059\u308b\u3002\u4eca\u56de\u306e\u30b9\u30b1\u30c3\u30c1\u3067\u306f<em>WiFi.softAP();<\/em> \u3067ssid\u3084\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u6307\u5b9a\u3057\u3066\u3044\u308b\u304c\u3001\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u5074\u3067\u306f\u30b9\u30ec\u30fc\u30d6\u306eMAC\u30a2\u30c9\u30ec\u30b9\u3092\u6307\u5b9a\u3059\u308b\u3060\u3051\u3067ssid\u3084\u30d1\u30b9\u30ef\u30fc\u30c9\u306f\u4f7f\u308f\u306a\u3044\u3002\u3042\u304f\u307e\u3067\u3054\u8fd1\u6240\u306e\u65b9\u304b\u3089\u306e\u3044\u305f\u305a\u3089\u63a5\u7d9a\u3092\u9632\u3050\u305f\u3081\u3067\u3001\u30b9\u30de\u30db\u304b\u3089\u898b\u3048\u306a\u3044\u3088\u3046SSID\u3082Hidden\u3068\u3057\u305f\u3002<\/p>\n<p>\u521d\u671f\u5316\u304c\u7d42\u308f\u308b\u3068\u3001<em>esp_now_register_recv_cb(onReceive);<\/em> \u306b\u3088\u3063\u3066\u30c7\u30fc\u30bf\u53d7\u4fe1\u5b8c\u4e86\u6642\u306e\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u95a2\u6570\u3092\u6307\u5b9a\u3057\u3001\u5f8c\u306f\u30c7\u30fc\u30bf\u53d7\u4fe1\u3092\u5f85\u3064\u3060\u3051\u306b\u306a\u308b\u3002<\/p>\n<p>ESP32\u7528\u306eAPI\u30d8\u30c3\u30c0\u30d5\u30a1\u30a4\u30eb\u306b\u306f\u3001\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u304b\u30b9\u30ec\u30fc\u30d6\u304b\u3092\u5ba3\u8a00\u3059\u308b\u305f\u3081\u306e\u3001<em>esp_now_set_self_role();<\/em> \u3068\u3044\u3046API\u304c\u5b58\u5728\u3057\u306a\u3044\u3002ESP8266\u7528SDK\u3068\u306f\u6982\u5ff5\u304c\u5909\u308f\u3063\u305f\u306e\u304b\u3082\u3057\u308c\u306a\u3044\u3057\u3001ESP32\u5074\u304c\u672a\u6574\u5099\u306a\u3060\u3051\u304b\u3082\u3057\u308c\u306a\u3044\u3002\u5c11\u306a\u304f\u3068\u3082\u3001\u4eca\u56de\u306e\u3088\u3046\u306bsoftAP\u30e2\u30fc\u30c9\u3092\u6307\u5b9a\u3057\u3066\u3044\u308b\u5834\u5408\u306f\u3001\u30b9\u30ec\u30fc\u30d6\u3068\u3057\u3066\u52d5\u4f5c\u3059\u308b\u3088\u3046\u3060\u3002<\/p>\n<p>\u307e\u305f\u3001<em>esp_now_add_peer();<\/em> \u306b\u3088\u3063\u3066\u63a5\u7d9a\u3092\u53d7\u3051\u5165\u308c\u308b\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u5074\u3092\u4e8b\u524d\u306b\u767b\u9332\u3057\u3066\u304a\u304f\u5fc5\u8981\u3082\u306a\u3044\u3088\u3046\u3060\u3002\u30b9\u30ec\u30fc\u30d6\u306eMAC\u30a2\u30c9\u30ec\u30b9\u5b9b\u306eESP_NOW\u9001\u4fe1\u306f\u3059\u3079\u3066\u53d7\u4fe1\u3059\u308b\u3088\u3046\u306b\u898b\u3048\u308b\u3002\u3053\u306e\u70b9\u306f\u3001\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u3068\u3057\u3066\u4f7f\u3046\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u5897\u3084\u3057\u305f\u308a\u5909\u3048\u305f\u308a\u3059\u308b\u305f\u3073\u306b\u30b9\u30ec\u30fc\u30d6\u5074\u30b9\u30b1\u30c3\u30c1\u3092\u76f4\u3055\u306a\u304f\u3066\u6e08\u3080\u304b\u3089\u697d\u3067\u3042\u308b\u3002\u9006\u306b\u3001\u3053\u306eAPI\u3092\u4f7f\u3063\u3066MAC\u30a2\u30c9\u30ec\u30b9\u3092\u767b\u9332\u3057\u3066\u304a\u304f\u3053\u3068\u3067\u53d7\u4fe1\u5bfe\u8c61\u3092\u9650\u5b9a\u3067\u304d\u308b\u306e\u304b\u3082\u3057\u308c\u306a\u3044\u304c\u3001\u4eca\u306e\u3068\u3053\u308d\u8a66\u3057\u3066\u3044\u306a\u3044\u3002<\/p>\n<h6>\u00a0void setup();<\/h6>\n<p>\u5404\u7a2e\u521d\u671f\u5316\u51e6\u7406\u3057\u3066start_espnow(); \u3092\u547c\u3073loop(); \u306b\u5165\u308b\u3002<\/p>\n<h6>void onReceive(const uint8_t *mac, const uint8_t *data, int data_len);<\/h6>\n<p><em>esp_now_register_recv_cb()<\/em> \u306e\u5f15\u6570\u3068\u306a\u308b\u30c7\u30fc\u30bf\u53d7\u4fe1\u901a\u77e5\u7528\u306e\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u95a2\u6570\u3067\u3001\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306bWiFi\u30bf\u30b9\u30af\u5185\u304b\u3089\u547c\u3073\u51fa\u3059\u306e\u3067\u3055\u3063\u3055\u3068\u4ed5\u4e8b\u3092\u7d42\u308f\u3089\u305b\u3088\u3068\u66f8\u3044\u3066\u3042\u308b\u3002<br \/>\n\u307e\u305a\u3001\u9001\u4fe1\u5074\u306eMAC\u30a2\u30c9\u30ec\u30b9\u3092\u5909\u6570 <em>sender_mac<\/em> \u306b\u30bb\u30c3\u30c8\u3057\u3001\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u5074\u3068\u53d6\u308a\u6c7a\u3081\u6e08\u307f\u306e\u30c7\u30fc\u30bf\u9577(\u00a0<em>sensor_data_t<\/em> \u69cb\u9020\u4f53\u306e\u30d0\u30a4\u30c8\u6570)\u304c\u4e00\u81f4\u3057\u3066\u3044\u308c\u3070\u53d7\u4fe1\u30c7\u30fc\u30bf\u3092\u5909\u6570<em>rx_data<\/em> \u306b\u30b3\u30d4\u30fc\u3059\u308b\u3002\u305d\u3057\u3066\u3001\u30c7\u30fc\u30bf\u5185\u306e\u30c1\u30a7\u30c3\u30af\u30b5\u30e0\u304c\u7b97\u51fa\u5024\u3068\u4e00\u81f4\u3057\u3066\u3044\u308c\u3070\u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570\u306e <em>data_received = true;<\/em> \u3068\u3057\u3066\u30ea\u30bf\u30fc\u30f3\u3059\u308b\u3002<\/p>\n<p>\u53d7\u4fe1\u3057\u305f\u30c7\u30fc\u30bf\u306e\u51e6\u7406\u4e2d\u306b\u6b21\u3092\u53d7\u4fe1\u3057\u3066\u3057\u307e\u308f\u306a\u3044\u3088\u3046\u3001<em>esp_now_unregister_recv_cb();<\/em> \u3092\u547c\u3073\u30c7\u30fc\u30bf\u306e\u53d7\u4fe1\u901a\u77e5\u3092\u89e3\u9664\u3059\u308b\u3002<\/p>\n<p>\u4eca\u56de\u306e\u5b9f\u88c5\u3067\u306f\u3001\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u30b9\u30ec\u30fc\u30d6\u9593\u306e\u30cf\u30f3\u30c9\u30b7\u30a7\u30a4\u30af\u304c\u306a\u3044\u306e\u3067\u3001\u3082\u3057\u3082\u7121\u52b9\u306a\u30c7\u30fc\u30bf(\u30c7\u30fc\u30bf\u9577\u9055\u3044\u3084\u30c1\u30a7\u30c3\u30af\u30b5\u30e0\u9055\u3044)\u306e\u53d7\u4fe1\u304c\u6210\u529f\u3057\u305f\u5834\u5408\u306e\u518d\u9001\u8981\u6c42\u3092\u884c\u3046\u624b\u6bb5\u304c\u306a\u3044\u3002\u304a\u305d\u3089\u304f\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u5074\u3067\u306f\u9001\u4fe1\u6210\u529f\u3068\u306a\u3063\u3066\u3044\u308b\u304b\u3089\u3001\u305d\u306e\u30c7\u30fc\u30bf\u306f\u518d\u9001\u3055\u308c\u305a\u5931\u308f\u308c\u308b\u3053\u3068\u306b\u306a\u308b\u3002<\/p>\n<h6>void loop();<\/h6>\n<p><em>onReceive();<\/em> \u304c\u7acb\u3066\u308b <em>data_recieved<\/em> \u3092\u898b\u3066\u3001\u30c7\u30fc\u30bf\u3092\u53d7\u4fe1\u3057\u3066\u3044\u308c\u3070\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u51e6\u7406\u3092\u884c\u3046\u3002<\/p>\n<ul>\n<li>\u53d7\u4fe1\u5b8c\u4e86\u5f8c\u306f\u3075\u3064\u3046\u306eWiFi\u30b9\u30c6\u30fc\u30b7\u30e7\u30f3\u3068\u3057\u3066\u632f\u308b\u821e\u308f\u305b\u308b\u305f\u3081\u3001\u307e\u305aesp_now_deinit(); \u306b\u3088\u3063\u3066ESP-NOW\u52d5\u4f5c\u3092\u505c\u6b62\u3059\u308b\u3002\u3053\u306e\u5f8cWeb\u30b5\u30fc\u30d0\u30fc\u3078\u306e\u30c7\u30fc\u30bf\u9001\u4fe1\u304c\u5b8c\u4e86\u3059\u308b\u307e\u3067\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u5074\u306e\u9001\u4fe1\u306f\u5931\u6557\u3059\u308b\u3053\u3068\u306b\u306a\u308b\u3002<\/li>\n<li>\u9001\u4fe1\u5074MAC\u30a2\u30c9\u30ec\u30b9\u304c\u521d\u898b\u306a\u3089\u3001MAC\u30a2\u30c9\u30ec\u30b9\u3001\u53d7\u4fe1\u6642\u523b\u3001\u53d7\u4fe1\u30b7\u30fc\u30b1\u30f3\u30b9\u756a\u53f7\u3092rx_log\u914d\u5217\u306b\u8ffd\u52a0\u3059\u308b\u3002\u6b63\u3057\u3044\u53d7\u4fe1\u30c7\u30fc\u30bf\u3068\u3057\u3066\u9001\u4fe1\u51e6\u7406\u3092\u884c\u3046\u3002<\/li>\n<li>\u3059\u3067\u306brx_log\u5185\u306b\u3042\u308bMAC\u30a2\u30c9\u30ec\u30b9\u304b\u3089\u306e\u53d7\u4fe1\u306a\u3089\u3070\u3001\u524d\u56de\u53d7\u4fe1\u6642\u306e\u30b7\u30fc\u30b1\u30f3\u30b9\u756a\u53f7\u3068\u4eca\u56de\u306e\u305d\u308c\u3092\u6bd4\u8f03\u3059\u308b\u3002\u540c\u4e00\u30b7\u30fc\u30b1\u30f3\u30b9\u756a\u53f7\u306a\u3089\u3070\u3001\u4e0d\u8981\u306a\u518d\u9001\u3068\u898b\u306a\u3057\u3066\u30c7\u30fc\u30bf\u3092\u5ec3\u68c4\u3059\u308b\u3002\u305d\u3046\u3067\u306a\u3051\u308c\u3070\u3001\u9001\u4fe1\u51e6\u7406\u306b\u9032\u3080\u3002<br \/>\n\u4e0d\u8981\u306a\u518d\u9001\u306f\u3001\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u5074\u304c\u5931\u6557\u3068\u898b\u306a\u3057\u3066\u518d\u9001\u3057\u305f\u3082\u306e\u306e\u3001\u5b9f\u306f\u76f4\u524d\u30c7\u30fc\u30bf\u3092\u30b9\u30ec\u30fc\u30d6\u5074\u3067\u6b63\u3057\u304f\u53d7\u4fe1\u3067\u304d\u3066\u3044\u305f\u3068\u304d\u306b\u751f\u3058\u308b\u3002<\/li>\n<\/ul>\n<p>\u4e0d\u8981\u306a\u518d\u9001\u306b\u95a2\u3059\u308b\u51e6\u7406\u306f\u3001\u540c\u30bf\u30a4\u30df\u30f3\u30b0\u3067\u306e\u91cd\u8907\u3057\u305f\u9001\u4fe1\u30c7\u30fc\u30bf\u3092\u6392\u9664\u3059\u308b\u51e6\u7406\u306b\u306a\u308b\u304c\u3001\u4eca\u56de\u306e\u5b9f\u88c5\u3067\u306f\u9001\u4fe1\u3054\u3068\u306b\u65b0\u3057\u3044\u6e2c\u5b9a\u30c7\u30fc\u30bf\u304c\u6765\u308b\u3060\u3051\u306a\u306e\u3067\u5b9f\u306f\u6c17\u306b\u3059\u308b\u5fc5\u8981\u306f\u306a\u3044\u3002\u305f\u3060\u3001\u305d\u306e\u3046\u3061\u8907\u6570\u30d5\u30ec\u30fc\u30e0\u306b\u308f\u305f\u308b\u30c7\u30fc\u30bf\u3092\u6271\u3046\u304b\u3082\u3057\u308c\u306a\u3044\u306e\u3067\u5165\u308c\u3066\u307f\u305f\u3002\u30b3\u30f3\u30c8\u30ed\u30fc\u30e94\u53f0\u30921\u5206\u9593\u9694\u3067\u52d5\u304b\u3057\u3066\u3044\u308b\u3088\u3046\u306a\u5834\u5408\u3001\u73fe\u5728\u306e\u30b9\u30b1\u30c3\u30c1\u3067\u306f\u8a18\u9332\u306b\u6b8b\u3089\u306a\u3044\u304c12\u6642\u9593\u306b1\u56de\u7a0b\u5ea6\u306f\u4e0d\u8981\u306a\u518d\u9001\u304c\u884c\u308f\u308c\u3066\u3044\u305f\u3002<\/p>\n<p>\u30c7\u30fc\u30bf\u3092\u53d7\u4fe1\u3059\u308b\u3068\u3001WiFi\u30b9\u30c6\u30fc\u30b7\u30e7\u30f3\u3068\u3057\u3066\u30c7\u30fc\u30bf\u3092Web\u30b5\u30fc\u30d0\u30fc\u9001\u4fe1\u3059\u308b\u305f\u3081<em>send_to_server();<\/em> \u3092\u547c\u3076\u3002\u305d\u3057\u3066<em>start_espnow();<\/em>\u00a0\u3067ESP-NOW\u3092\u518d\u958b\u3057loop() \u306e\u5148\u982d\u306b\u623b\u308b\u3002<\/p>\n<h6>bool ap_connect(); \u3068 bool send_to_server();<\/h6>\n<p>ESP8266\u3084ESP32\u3092WiFi\u30b9\u30c6\u30fc\u30b7\u30e7\u30f3\u3068\u3057\u3066\u4f7f\u3046\u3068\u304d\u306e\u5178\u578b\u7684\u306a\u30b3\u30fc\u30c9\u3067\u3001\u9759\u7684IP\u30a2\u30c9\u30ec\u30b9\u3092\u3082\u3064\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3068\u3057\u3066WiFi\u30eb\u30fc\u30bf\u30fc(\u30a2\u30af\u30bb\u30b9\u30dd\u30a4\u30f3\u30c8)\u306b\u63a5\u7d9a\u3057\u3001HTTP GET\u30ea\u30af\u30a8\u30b9\u30c8\u3067<em>rx_data<\/em> \u306e\u5185\u5bb9\u3092Web\u30b5\u30fc\u30d0\u30fc\u306b\u9001\u4fe1\u3059\u308b\u3002ESP32\u3092\u4f7f\u3063\u3066\u3082\u3001\u30a2\u30af\u30bb\u30b9\u30dd\u30a4\u30f3\u30c8\u306b\u63a5\u7d9a\u3059\u308b\u306e\u306b3\u79d2\u3061\u3087\u3063\u3068\u304b\u304b\u3063\u3066\u3057\u307e\u3046\u3002\u3046\u3061\u306eWiFi\u30eb\u30fc\u30bf\u30fc\u3092\u65b0\u3057\u304f\u3059\u308b\u3068\u901f\u304f\u306a\u308b\u306e\u304b\u3082\u3057\u308c\u306a\u3044\u304c\u3002<\/p>\n<p>\u5404\u30c7\u30fc\u30bf\u306f\u3001\u30ea\u30af\u30a8\u30b9\u30c8\u30d1\u30e9\u30e1\u30fc\u30bf\u540d\u3068\u540c\u3058\u540d\u524d\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30ab\u30e9\u30e0\u306b\u683c\u7d0d\u3055\u308c\u308b\u3002\u30ea\u30af\u30a8\u30b9\u30c8\u30d1\u30e9\u30e1\u30fc\u30bf\u306eX1\u306f\u9001\u4fe1\u90fd\u5ea6\u3054\u3068\u306eWiFi\u7a3c\u50cd\u6642\u9593\u3001X2\u306f\u9001\u4fe1\u6210\u529f\u307e\u3067\u306e\u30ea\u30c8\u30e9\u30a4\u56de\u6570\u3092\u3082\u3064\u3002\u4f8b\u3048\u3070\u3001<br \/>\n<em>\u00a0 \u00a0select avg(x1) from envdata10 where post_datetime between start_timestamp and last_timestamp;<\/em><br \/>\n\u3068\u3044\u3063\u305f\u30b7\u30f3\u30d7\u30eb\u306aSQL\u6587\u3067\u3001\u6307\u5b9a\u671f\u9593\u306b\u304a\u3051\u308b\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u306e\u5e73\u5747\u7a3c\u50cd\u6642\u9593\u3092\u5f97\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3002<br \/>\n<a href=\"https:\/\/okiraku-camera.tokyo\/blog\/?page_id=7007#3\" target=\"_blank\" rel=\"noopener\">\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u5b9a\u7fa9\u3084\u69cb\u9020\u306f\u5f93\u6765\u3068\u540c\u69d8<\/a>\u306b\u3057\u305f\u3002\u305f\u3060\u3001\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u3054\u3068\u306b\u5225\u306e\u30c6\u30fc\u30d6\u30eb\u306b\u683c\u7d0d\u3059\u308b\u3088\u3046\u306b\u3057\u305f\u306e\u3067\u3001\u6e2c\u5b9a\u30c7\u30fc\u30bf\u683c\u7d0d\u7528\u30b9\u30af\u30ea\u30d7\u30c8(store_data.php) \u306e\u5185\u5bb9\u306f\u5909\u66f4\u3057\u4eca\u56de\u306e\u30b9\u30b1\u30c3\u30c1\u985e\u3068\u3068\u3082\u306b\u63b2\u8f09\u3057\u305f\u3002<\/p>\n<h2>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u5074\u6982\u7565<\/h2>\n<h3>\u56de\u8def\u306a\u3069<\/h3>\n<p>ESP-NOW\u3092\u4f7f\u3046\u304b\u3089\u3068\u884c\u3063\u3066\u7279\u5225\u306b\u56de\u8def\u306b\u5de5\u592b\u304c\u3044\u308b\u308f\u3051\u3067\u306a\u3044\u3002\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u5074\u306f\u4eca\u307e\u3067\u3068\u540c\u69d8\u306bESP-WROOM-02(D)\u306b\u6e29\u5ea6\u30bb\u30f3\u30b5\u30fcBME280 \/ BMP280\u3092\u4f7f\u3063\u305f\u3002WROOM-02\u7121\u53702\u53f0\u3068&#8221;D&#8221;\u4ed8\u304d2\u53f0\u3092\u4f7f\u3063\u305f\u304c\u3001&#8221;D&#8221;\u306e\u65b9\u304c\u65e9\u3044\u3068\u3044\u3046\u3053\u3068\u306f\u306a\u304b\u3063\u305f\u3002\u30b9\u30a4\u30c3\u30c1\u30b5\u30a4\u30a8\u30f3\u30b9\u306e\u30d5\u30eb\u7248\u5909\u63db\u57fa\u677f\u306b\u8f09\u305b\u305fWROOM-02D\u3092\u4f7f\u3063\u305f\u30dc\u30fc\u30c9\u3067\u306f\u3001\u5b9f\u9a13\u7684\u306b+3.0V\u51fa\u529b\u306e<a href=\"http:\/\/ww1.microchip.com\/downloads\/en\/DeviceDoc\/22008E.pdf\" target=\"_blank\" rel=\"noopener\">\u5b9a\u96fb\u5727\u30ec\u30ae\u30e5\u30ec\u30fc\u30bfMCP-1702-300<\/a> \u3092\u4f7f\u3063\u3066\u3044\u308b\u3002<\/p>\n<figure id=\"attachment_7191\" aria-describedby=\"caption-attachment-7191\" style=\"width: 552px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/okiraku-camera.tokyo\/blog\/wp-content\/uploads\/2018\/05\/6c6221dbe01aa786c827780637f87244.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-large wp-image-7191\" src=\"https:\/\/okiraku-camera.tokyo\/blog\/wp-content\/uploads\/2018\/05\/6c6221dbe01aa786c827780637f87244-552x414.jpg\" alt=\"ESP-WROOM-02D\" width=\"552\" height=\"414\" \/><\/a><figcaption id=\"caption-attachment-7191\" class=\"wp-caption-text\">ESP-WROOM-02D\u3068\u5e45\u306e\u5e83\u3044\u30d6\u30ec\u30c3\u30c9\u30dc\u30fc\u30c9<\/figcaption><\/figure>\n<p>\u30d5\u30eb\u7248\u5909\u63db\u57fa\u677f\u306e\u4e0b\u306b\u62b5\u6297\u3084\u30ef\u30a4\u30e4\u3092\u914d\u7f6e\u3059\u308b\u3053\u3068\u3067\u4e3b\u8981\u90e8\u5206\u306f\u5de6\u534a\u5206\u306b\u53ce\u307e\u3063\u305f\u3002\u53f3\u7aef\u306b\u898b\u3048\u308bTO-92\u30d1\u30c3\u30b1\u30fc\u30b8\u306e3\u672c\u8db3\u304cMCP1702\u3067\u3001\u305d\u306e\u5468\u8fba\u306e\u62b5\u6297\u306f\u96fb\u5727\u6e2c\u5b9a\u306e\u305f\u3081\u306e\u5206\u5727\u7528\u3002RST\u30d4\u30f3\u306fGPIO16\u306b\u306e\u307f\u63a5\u7d9a\u3057\u3001\u624b\u52d5\u30ea\u30bb\u30c3\u30c8\u3084UART\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u306e\u958b\u59cb\u306fEN\u306b\u3064\u306a\u304c\u3063\u305f\u30b9\u30a4\u30c3\u30c1\u3067\u884c\u3046\u3002<\/p>\n<figure id=\"attachment_7172\" aria-describedby=\"caption-attachment-7172\" style=\"width: 552px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/okiraku-camera.tokyo\/blog\/wp-content\/uploads\/2018\/04\/WROOM02-SS-BMP280-MCP1702-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-large wp-image-7172\" src=\"https:\/\/okiraku-camera.tokyo\/blog\/wp-content\/uploads\/2018\/04\/WROOM02-SS-BMP280-MCP1702-1-552x466.png\" alt=\"\" width=\"552\" height=\"466\" \/><\/a><figcaption id=\"caption-attachment-7172\" class=\"wp-caption-text\">WROOM02-SS-BME280-MCP1702-1\u3002<\/figcaption><\/figure>\n<p>MCP1702\u306e\u5b9a\u683c\u51fa\u529b\u96fb\u6d41\u306f\u6700\u5927250mA\u3067WROOM-02\u3067\u306e\u4f7f\u7528\u306b\u306f\uff1f\u304c\u4ed8\u304f\u306e\u3060\u304c\u3001\u9759\u6b62\u6642\u96fb\u6d41\u304c5\u03bcA max \u3068\u3044\u3046\u3053\u3068\u3067\u3001\u30b9\u30ea\u30fc\u30d7\u6642\u306e\u6d88\u8cbb\u96fb\u6d41\u3092\u6291\u3048\u308b\u305f\u3081\u306b\u4f7f\u3063\u3066\u307f\u308b\u3053\u3068\u306b\u3057\u305f\u3002<br \/>\n\u30c7\u30a3\u30fc\u30d7\u30b9\u30ea\u30fc\u30d7\u4e2d\u306e\u96fb\u6d41\u3092\u3001\u30dc\u30fc\u30c9\u306eGND\u3068\u96fb\u6c60\u306e\u30fc\u306e\u9593\u306b\u30c6\u30b9\u30bf\u30fc\u3092\u306f\u3055\u3093\u3067\u6e2c\u3063\u3066\u307f\u308b\u3068\u7d0435\u03bcA\u3060\u3063\u305f\u3002\u5206\u5727\u56de\u8def\u306b10\u03bcA\u3001WROOM-02\u306b20\u03bcA\u3068\u3059\u308b\u3068\u307b\u307c\u8a08\u7b97\u901a\u308a\u3067\u3042\u308a\u3001NJU7223F33\u3092\u4f7f\u3063\u305f\u3068\u304d\u304b\u3089\u7d0425\u03bcA\u6539\u5584\u3057\u3066\u3044\u308b\u3002<\/p>\n<p>\u30b9\u30b1\u30c3\u30c1\u3084\u3053\u306e\u8a18\u4e8b\u3092\u66f8\u304d\u59cb\u3081\u3066\u304b\u30891\u9031\u9593\u307b\u3069\u7a3c\u50cd\u3055\u305b\u3066\u3044\u308b\u304c\u5b89\u5b9a\u3057\u3066\u52d5\u3044\u3066\u3044\u308b(\u3088\u3046\u306b\u898b\u3048\u308b)\u3002\u554f\u984c\u306f\u96fb\u6c60\u304c\u30d8\u30bf\u3063\u3066\u304d\u305f\u3068\u304dWROOM-02\u958b\u59cb\u6642\u306e\u96fb\u6d41\u3067\u3069\u308c\u3060\u3051\u30c9\u30ed\u30c3\u30d7\u30a2\u30a6\u30c8\u3059\u308b\u304b\u3060\u3068\u601d\u3046\u304c\u3001\u96fb\u6c60\u96fb\u5727\u304c4V\u672a\u6e80\u306b\u306a\u308b\u307e\u3067\u306b\u306f\u9577\u3044\u6642\u9593\u304c\u304b\u304b\u308a\u305d\u3046\u3067\u3042\u308b\u3002<\/p>\n<p>ESP8266\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306b\u5f93\u3048\u3070 \u3001WROOM-02\u306b\u4e0e\u3048\u308b\u96fb\u6e90\u96fb\u5727\u3092+3.0V\u306b\u3057\u305f\u306e\u3067\u3001<em>esp_init_data_default.bin<\/em> \u306e107\u756a\u76ee\u306b33 \u3067\u306f\u306a\u304f30\u3068\u66f8\u304f\u5fc5\u8981\u304c\u3042\u308b\u3088\u3046\u3060\u3002RF\u52d5\u4f5c\u306e\u6700\u9069\u5316\u306e\u305f\u3081\u3068\u3044\u3046\u3053\u3068\u3060\u304c\u3001\u3068\u308a\u3042\u3048\u305a\u6c17\u306b\u3057\u306a\u3044\u3053\u3068\u306b\u3057\u305f\u3002<\/p>\n<h3>\u52d5\u4f5c\u304a\u3088\u3073\u30b9\u30b1\u30c3\u30c1<\/h3>\n<p>\u6e2c\u5b9a\u9593\u9694\u6642\u9593\u3054\u3068\u306b\u30c7\u30a3\u30fc\u30d7\u30b9\u30ea\u30fc\u30d7\u304b\u3089\u5fa9\u5e30\u3057\u3001\u6e2c\u5b9a\u3068\u9001\u4fe1\u3092\u884c\u3063\u305f\u5f8c\u306b\u30c7\u30a3\u30fc\u30d7\u30b9\u30ea\u30fc\u30d7\u306b\u5165\u308b\u3002\u30ea\u30c8\u30e9\u30a4\u3057\u306a\u3044\u5834\u5408\u306e\u6240\u7528\u6642\u9593\u306f\u500b\u4f53\u5dee\u304c\u3042\u3063\u3066\u7d0420\uff5e25msec\u3060\u3063\u305f\u3002\u4eca\u307e\u3067WiFi\u63a5\u7d9a\u304b\u3089\u9001\u4fe1\u307e\u3067\u6700\u77ed\u3067\u30823\u79d2\u9593\u306f\u304b\u304b\u3063\u3066\u3044\u305f\u306e\u3067\u3001WiFi\u7a3c\u50cd\u6642\u306e\u5e73\u5747\u6d88\u8cbb\u96fb\u6d41\u306f\u5358\u7d14\u306b\u8003\u3048\u30661\/100\u4ee5\u4e0b\u3068\u306a\u308b\u3002<br \/>\n25msec\u306e\u5185\u8a33\u306f\u3001\u30b9\u30ea\u30fc\u30d7\u5fa9\u5e30\u304b\u3089\u9001\u4fe1\u76f4\u524d\u307e\u3067\u304c23msec\u3067\u3001\u9001\u4fe1\u7d50\u679c\u3092\u53d6\u5f97\u3057\u3066\u6700\u5f8c\u306brtc\u30e1\u30e2\u30ea\u3092\u66f4\u65b0\u3059\u308b\u307e\u304c2msec\u7a0b\u5ea6\u3060\u3063\u305f\u3002\u306a\u304a\u3001\u30c7\u30a3\u30fc\u30d7\u30b9\u30ea\u30fc\u30d7\u5fa9\u5e30\u4ee5\u5916(\u96fb\u6e90\u30aa\u30f3\u3001\u624b\u52d5\uff0f\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u30ea\u30bb\u30c3\u30c8)\u3067\u306f\u3001\u96fb\u6e90\u6295\u5165\u6642\u306eBME280\u306e\u5b89\u5b9a\u5316\u306e\u305f\u3081\u306bdelay(10) \u3092\u5165\u308c\u3066\u3044\u308b\u304b\u308910msec\u4f59\u8a08\u306b\u304b\u304b\u308b\u3002<\/p>\n<p>\u500b\u3005\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u3054\u3068\u306b\u30e6\u30cb\u30fc\u30af\u306a\u8b58\u5225\u5b50\u306a\u3069\u3092\u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u5165\u308c\u3066\u304a\u304f\u5fc5\u8981\u3082\u306a\u3044\u306e\u3067\u3001ESP8266 Arduino Core (2.4.1)\u3092\u4f7f\u3063\u3066\u30d3\u30eb\u30c9\u3057\u305f\u540c\u3058\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u3059\u3079\u3066\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u306b\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u305f\u3002\u305f\u3060\u3001\u30ea\u30c8\u30e9\u30a4\u518d\u9001\u6642\u306e\u6642\u9593\u8abf\u6574\u306e\u305f\u3081\u3001MAC\u30a2\u30c9\u30ec\u30b9\u3092\u30b7\u30fc\u30c9\u3068\u3057\u305f\u64ec\u4f3c\u4e71\u6570\u3092\u4f7f\u3063\u3066\u3044\u308b\u3002<\/p>\n<p><a href=\"\/blog\/?page_id=7178#2\" target=\"_blank\" rel=\"noopener\">\u30b9\u30b1\u30c3\u30c1\u81ea\u4f53\u306f\u3053\u3061\u3089<\/a>\u3002<\/p>\n<h4>\u304a\u3082\u306a\u30c7\u30fc\u30bf<\/h4>\n<h6>uint8_t slave_mac[] = {&#8230;};<\/h6>\n<p>\u3053\u306e\u5909\u6570\u306b\u306f\u30b9\u30ec\u30fc\u30d6\u5074\u306eMAC\u30a2\u30c9\u30ec\u30b9\u3092\u30d0\u30a4\u30ca\u30ea\u3067\u6307\u5b9a\u3059\u308b\u3002\u3053\u306e\u30b9\u30ec\u30fc\u30d6\u306b\u5bfe\u3057\u3066\u306e\u307f\u9001\u4fe1\u3092\u884c\u3046\u3002\u30b9\u30ec\u30fc\u30d6\u3068\u3057\u3066\u4f7f\u3046ESP32\u3092\u5909\u66f4\u3057\u305f\u969b\u306b\u306f\u3059\u3079\u3066\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u306b\u5bfe\u3057\u3066\u540c\u3058\u30d0\u30a4\u30ca\u30ea\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u76f4\u3059\u306e\u304c\u9762\u5012\u304b\u3082\u3057\u308c\u306a\u3044\u3002\u5225\u30da\u30fc\u30b8\u306b\u63b2\u8f09\u3057\u305f\u30b9\u30b1\u30c3\u30c1\u3067\u306f\u4e00\u90e8\u4f0f\u305b\u5b57\u3068\u3057\u3066\u3044\u308b\u3053\u3068\u306b\u6ce8\u610f\u3002<\/p>\n<h6>unsigned long start_time = millis();<\/h6>\n<p>\u96fb\u6e90\u30aa\u30f3\u3001\u30c7\u30a3\u30fc\u30d7\u30b9\u30ea\u30fc\u30d7\u3001\u624b\u52d5\u30ea\u30bb\u30c3\u30c8\u7b49\u306b\u3088\u308b\u5fa9\u5e30\u6642\u306e\u64ec\u4f3c\u7684\u306a\u6642\u523b( <em>millis()<\/em> )\u3092\u8a18\u61b6\u3059\u308b\u305f\u3081\u306e\u5909\u6570\u3002\u3053\u3046\u66f8\u3044\u3066\u304a\u304f\u3068<em>setup();<\/em> \u304c\u547c\u3070\u308c\u308b\u524d\u306b\u5024\u304c\u8a2d\u5b9a\u3055\u308c\u308b\u3002<\/p>\n<h6>enum { S_WAIT = 0, S_SUCCESS , S_RETRY, S_TIMEOUT, S_FAILED } state = S_WAIT;<\/h6>\n<p><em>send_data();<\/em> \u95a2\u6570\u306e\u623b\u308a\u5024\u306e\u5b9a\u7fa9\u3002\u30c7\u30fc\u30bf\u9001\u4fe1\u306e\u6210\u529f\u4e0d\u6210\u529f\u3084\u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\u306e\u5224\u5b9a\u306b\u7528\u3044\u3066\u3044\u308b\u3002<\/p>\n<h4>\u304a\u3082\u306a\u95a2\u6570<\/h4>\n<h6>void setup();<\/h6>\n<p>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u5074\u306f\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u304c\u306a\u3044\u306e\u3067 <em>setup()<\/em> \u5185\u3067\u5b8c\u7d50\u3057\u3066\u3044\u308b\u3002\u30ea\u30c8\u30e9\u30a4\u6642\u306a\u3069\u3082\u4e00\u65e6\u30c7\u30a3\u30fc\u30d7\u30b9\u30ea\u30fc\u30d7\u306b\u5165\u308a\u3001\u6b21\u56de\u8d77\u52d5\u6642\u306b\u51e6\u7406\u3092\u7d9a\u884c\u3059\u308b\u3002\u72b6\u614b\u3092\u7dad\u6301\u3059\u308b\u305f\u3081\u3001\u30b9\u30ec\u30fc\u30d6\u5074\u3068\u540c\u3058 <em>sensor_data_t<\/em> \u69cb\u9020\u4f53\u3092RTC\u30e1\u30e2\u30ea\u5185\u306b\u4fdd\u6301\u3059\u308b\u3002<\/p>\n<p>\u958b\u59cb\u3059\u308b\u3068\u3001<em>ESP.getResetInfoPtr();<\/em> \u306b\u3088\u3063\u3066\u30ea\u30b9\u30bf\u30fc\u30c8\u3057\u305f\u7406\u7531\u3092\u5f97\u3066\u3001\u30c7\u30a3\u30fc\u30d7\u30b9\u30ea\u30fc\u30d7\u5fa9\u5e30\u306a\u3089\u3070RTC\u30e1\u30e2\u30ea\u304b\u3089sensor_data_t \u578b\u306e\u30c7\u30fc\u30bf\u3092\u5909\u6570<em>data<\/em>\u306b\u8aad\u307f\u8fbc\u3080\u3057\u3001\u305d\u3046\u3067\u306a\u3044\u306a\u3089<em>data<\/em>\u3092\u521d\u671f\u5316\u3059\u308b\u3002\u96fb\u6e90\u30aa\u30f3\u3001\u624b\u52d5\u30ea\u30bb\u30c3\u30c8\u3001\u30b9\u30b1\u30c3\u30c1\u306b\u3088\u308b\u30ea\u30b9\u30bf\u30fc\u30c8\u306a\u3069\u304c\u6709\u308a\u3046\u308b\u3002<br \/>\nRST\u30d4\u30f3\u306b\u30ea\u30bb\u30c3\u30c8\u30b9\u30a4\u30c3\u30c1\u3092\u63a5\u7d9a\u3057\u3066\u3044\u308b\u69cb\u6210\u3067\u306f\u3001\u30c7\u30a3\u30fc\u30d7\u30b9\u30ea\u30fc\u30d7\u4e2d\u306b\u30ea\u30bb\u30c3\u30c8\u30b9\u30a4\u30c3\u30c1\u3092\u62bc\u3057\u3066\u3082\u5fa9\u5e30\u3068\u30ea\u30bb\u30c3\u30c8\u306e\u533a\u5225\u304c\u4ed8\u304b\u306a\u3044\u306e\u3067\u3001\u4e0a\u306e\u56de\u8def\u306e\u3088\u3046\u306bEN\u30d4\u30f3\u306b\u30ea\u30bb\u30c3\u30c8\u30b9\u30a4\u30c3\u30c1\u3092\u63a5\u7d9a\u3057\u3066\u3044\u308b\u3002\u307e\u305f\u3001RTC\u304b\u3089\u8aad\u307f\u51fa\u3057\u305f\u30c7\u30fc\u30bf\u304c\u7834\u640d\u3057\u3066\u3044\u305f\u3068\u304d\u3082\u00a0<em>data<\/em>\u3092\u521d\u671f\u5316\u3059\u308b\u3002<\/p>\n<p>\u6b21\u306b\u3001\u30b9\u30c6\u30fc\u30b7\u30e7\u30f3\u306eMAC\u30a2\u30c9\u30ec\u30b9 ( <em>WiFi.macAddress(sta_mac)<\/em>) \u3092\u5f97\u3066Arduino\u306e\u64ec\u4f3c\u4e71\u6570\u5217\u751f\u6210\u7528\u306e\u30b7\u30fc\u30c9\u3068\u3057\u3066\u3044\u308b\u3002<em>random()<\/em>\u3067\u5f97\u3089\u308c\u308b\u5024\u306f\u30ea\u30c8\u30e9\u30a4\u6642\u3084\u518d\u9001\u304c\u3042\u3063\u305f\u969b\u306e\u6e2c\u5b9a\u9593\u9694\u306e\u8abf\u6574\u306e\u305f\u3081\u306b\u4f7f\u3046\u3082\u306e\u3067\u3001\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u3054\u3068\u306b\u30e6\u30cb\u30fc\u30af\u306a\u5024\u306b\u306a\u3063\u3066\u304f\u308c\u308c\u3070\u3088\u3044\u3002<\/p>\n<pre class=\"lang:default decode:true\">  if (esp_now_init() != ESP_OK)\r\n    die(\"ESPNow Init Failed\"); \r\n  esp_now_set_self_role(ESP_NOW_ROLE_CONTROLLER);\r\n  if ( esp_now_add_peer(slave_mac, ESP_NOW_ROLE_SLAVE, WIFI_CHANNEL, NULL, 0) != ESP_OK)\r\n    die(\"esp_now_add_peer() failed.\");<\/pre>\n<p>\u306b\u3088\u3063\u3066ESP-NOW\u3092\u521d\u671f\u5316\u3059\u308b\u3002<em>die();<\/em> \u306fLED\u3092\u70b9\u6ec5\u3055\u305b\u306a\u304c\u3089\u7121\u9650\u30eb\u30fc\u30d7\u3059\u308b\u95a2\u6570\u3067\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u9014\u4e0a\u306b\u306e\u307f\u6709\u7528\u3002<\/p>\n<p>\u305d\u3057\u3066<em>send_data();<\/em> \u3092\u547c\u3073\u3001\u30bb\u30f3\u30b5\u30fc\u3092\u4f7f\u3063\u305f\u6e2c\u5b9a\u3068\u30c7\u30fc\u30bf\u306e\u9001\u4fe1\u3092\u884c\u3046\u3002\u3053\u306e\u95a2\u6570\u304c\u8fd4\u3057\u305f\u9001\u4fe1\u7d50\u679c\u306b\u5fdc\u3058\u3066\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u51e6\u7406\u3059\u308b\u3002<\/p>\n<ul>\n<li><em>S_SUCCESS<\/em><br \/>\n\u9001\u4fe1\u304c\u6210\u529f\u3057\u305f\u306e\u3067\u3001\u6b21\u56de\u9001\u4fe1\u306e\u305f\u3081\u306b\u30b7\u30fc\u30b1\u30f3\u30b9\u756a\u53f7(<em>data.seq_no<\/em>)\u3092\u30a4\u30f3\u30af\u30ea\u30e1\u30f3\u30c8\u3068\u3057\u3001<em>data.retry = 0;<\/em> \u306b\u3088\u308a\u9001\u4fe1\u6210\u529f\u72b6\u614b\u3068\u3057\u3001\u30b9\u30ea\u30fc\u30d7\u6642\u9593(<em>sleep_ms<\/em>)\u306b\u6e2c\u5b9a\u9593\u9694\u3092\u30bb\u30c3\u30c8\u3059\u308b\u3002\u305f\u3060\u3057\u3001\u518d\u9001\u3092\u7d4c\u3066\u306e\u9001\u4fe1\u6210\u529f\u306a\u3089\u3070\u3001\u4ed6\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u306e\u9001\u4fe1\u30bf\u30a4\u30df\u30f3\u30b0\u3068\u8fd1\u3044\u306f\u305a\u306a\u306e\u3067\u6b21\u56de\u6e2c\u5b9a\u3092\u5c11\u3057\u9045\u3089\u305b\u308b\u3002<\/li>\n<li><em>S_RETRY<\/em><br \/>\n\u9001\u4fe1\u5931\u6557\u3092\u691c\u51fa\u3057\u305f\u306e\u3067<em>data.retry++;<\/em> \u3057\u3066\u30ea\u30c8\u30e9\u30a4\u72b6\u614b\u3068\u3059\u308b\u3002\u305d\u3057\u3066<em> random()<\/em> \u3067\u5f97\u3089\u308c\u305f\u6642\u9593(1\uff5e2\u79d2)\u3092<em>sleep_ms<\/em>\u306b\u30bb\u30c3\u30c8\u3057\u3066\u6b21\u56de\u8d77\u52d5\u6642\u306b\u518d\u9001\u3055\u305b\u308b\u3002<br \/>\n\u30ea\u30c8\u30e9\u30a4\u72b6\u614b\u304c10\u56de\u9023\u7d9a\u3057\u305f\u3089\u3042\u304d\u3089\u3081\u3066<em>ESP.restart();<\/em> \u3059\u308b\u3002<\/li>\n<li><em>S_TIMEOUT<\/em><br \/>\n<em>send_data();<\/em> \u5185\u3067\u9001\u4fe1\u5f8c1\u79d2\u305f\u3063\u3066\u3082\u9001\u4fe1\u7d50\u679c\u304c\u5f97\u3089\u308c\u306a\u304b\u3063\u305f\u306e\u3067\u3001\u4eca\u56de\u306f\u306a\u304b\u3063\u305f\u3053\u3068\u306b\u3057\u3066<em>sleep_ms<\/em> \u306b10000\u3092\u30bb\u30c3\u30c8\u3059\u308b\u3002S_RETRY\u3068\u540c\u69d8\u306b\u51e6\u7406\u3057\u3066\u3082\u3044\u3044\u304b\u3082\u3057\u308c\u306a\u3044\u3002<\/li>\n<li><em>S_FAILED<\/em><br \/>\n<em>send_data();<\/em> \u5185\u3067\u306eAPI\u547c\u51fa\u3057\u306e\u5931\u6557\u3092\u8868\u3059\u3002<\/li>\n<\/ul>\n<p>\u9001\u4fe1\u5931\u6557\u309210\u56de\u7e70\u308a\u8fd4\u3059\u539f\u56e0\u3068\u3057\u3066\u306f\u30b9\u30ec\u30fc\u30d6\u5074\u306e\u96fb\u6e90\u304c\u30aa\u30d5\u306b\u306a\u3063\u3066\u3044\u308b\u3001\u3068\u304b\u3001\u30b9\u30b1\u30c3\u30c1\u3092\u5165\u308c\u66ff\u3048\u3066\u3044\u308b\u3068\u304b\u304c\u8003\u3048\u3089\u308c\u308b\u3002<em>ESP.restart()<\/em> \u3059\u308c\u3070\u6700\u521d\u304b\u3089\u3084\u308a\u76f4\u3057\u306b\u306a\u308b\u306e\u3060\u304c\u3001\u9577\u3081\u306e\u30b9\u30ea\u30fc\u30d7\u3092\u3044\u308c\u3066\u3084\u308b\u65b9\u304c\u96fb\u6c60\u306b\u512a\u3057\u3044\u304b\u3082\u3057\u308c\u306a\u3044\u3002<\/p>\n<p>\u6700\u5f8c\u306b\u3001<em>data<\/em>\u306e\u5185\u5bb9\u3092RTC\u30e1\u30e2\u30ea\u306b\u66f8\u304d\u51fa\u3057\u3001<em>sleep_ms<\/em> \u671f\u9593\u306e\u30c7\u30a3\u30fc\u30d7\u30b9\u30ea\u30fc\u30d7\u306b\u5165\u308b\u3002<\/p>\n<h6>int send_data(sensor_data_t* p);<\/h6>\n<p>\u307e\u305a\u306f\u30bb\u30f3\u30b5\u30fc\u30a4\u30f3\u30bf\u30d5\u30a7\u30fc\u30b9\u7528\u306e<em>bme280<\/em>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u4f7f\u3063\u3066\u6e2c\u5b9a\u3092\u884c\u3044\u9001\u4fe1\u306e\u305f\u3081\u306b\u30c7\u30fc\u30bf\u306e\u30c1\u30a7\u30c3\u30af\u30b5\u30e0\u3092\u30bb\u30c3\u30c8\u3059\u308b\u3002\u305d\u3057\u3066\u3001<br \/>\n<em>\u3000\u3000esp_now_register_send_cb(onSent);\u00a0<\/em><br \/>\n\u306b\u3088\u3063\u3066\u9001\u4fe1\u7d42\u4e86\u6642\u306e\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u95a2\u6570\u3092\u30bb\u30c3\u30c8\u3057\u3001<br \/>\n<em>\u3000\u3000esp_now_send(slave_mac, (u8*)p,<\/em> sizeof(sensor_data_t));<br \/>\n\u3067\u9001\u4fe1\u3092\u884c\u3046\u3002\u3053\u306eAPI\u304c\u30a8\u30e9\u30fc\u3092\u8fd4\u3057\u305f\u3089\u3001<em>S_FAILED<\/em>\u3092\u30ea\u30bf\u30fc\u30f3\u3059\u308b\u3002<\/p>\n<p>\u9001\u4fe1\u5b9f\u884c\u5f8c\u3001\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u95a2\u6570\u306e<em>onSent()<\/em> \u306b\u3088\u3063\u3066\u5909\u6570\u00a0<em>state<\/em> \u306e\u5024\u304c\u66f4\u65b0\u3055\u308c\u308b\u306e\u3092\u5f85\u3061\u3001<em>esp_now_unregister_send_cb();<\/em> \u306b\u3088\u3063\u3066\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u95a2\u6570\u3092\u89e3\u9664\u3057\u3066\u304b\u3089<em>state<\/em>\u306e\u5024\u3092\u30ea\u30bf\u30fc\u30f3\u3059\u308b\u3002<em>state<\/em>\u306e\u5024\u304c1\u79d2\u4ee5\u5185\u306e\u66f4\u65b0\u3055\u308c\u306a\u3051\u308c\u3070\u3001<em>S_TIMEOUT<\/em> \u3092\u30ea\u30bf\u30fc\u30f3\u3059\u308b\u3002<\/p>\n<h2>\u305d\u306e\u4ed6<\/h2>\n<h3>\u96fb\u6c60\u306e\u30e2\u30c1<\/h3>\n<p>1\u6642\u9593\u306b10\u56de\u3001\u3064\u307e\u308a6\u5206\u9593\u306b\u4e00\u5ea6\u6e2c\u5b9a\u3068\u9001\u4fe1\u3092\u884c\u3044\u3001\u518d\u9001\u7121\u3057\u3067\u7406\u60f3\u7684\u306b\u52d5\u4f5c\u3057\u305f\u5834\u5408\u306b\u6d88\u8cbb\u3059\u308b\u96fb\u6c60\u5bb9\u91cf\u306b\u3064\u3044\u3066\u3001\u5f93\u6765\u65b9\u5f0f\u3068\u6bd4\u8f03\u3059\u308b\u3068\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308b\u3002\u5f93\u6765\u65b9\u5f0f\u3067\u306f1\u56de\u306e\u6e2c\u5b9a\u3068\u9001\u4fe1\u306b3\u79d2\u304b\u304b\u308b\u3082\u306e\u3068\u3057\u305f\u3002<\/p>\n<ul>\n<li>\u5f93\u6765\u65b9\u5f0f: WiFi\u7a3c\u50cd\u6642\u9593\u306f30\u79d2\u9593\u3001(30 \u00d7 90 \u00f7 3600) + 0.06 = 0.81mAh\u3002\u7d0498\u65e5\u9593\u7a3c\u50cd\u3002<\/li>\n<li>ESP-NOW\u65b9\u5f0f: WiFi\u7a3c\u50cd\u6642\u9593\u306f0.25\u79d2\u9593\u3001(0.25 \u00d7 90 \u00f7 3600) + 0.06 = 0.066mAh\u3002\u7d041200\u65e5\u9593\u7a3c\u50cd\u3002<\/li>\n<\/ul>\n<p>(WiFi\u7a3c\u50cd\u664290mA\u3001\u30b9\u30ea\u30fc\u30d7\u664260\u03bcA\u3001\u96fb\u6c60\u5bb9\u91cf\u30921900mAh\u3068\u3057\u3066\u7b97\u51fa)\u3002<\/p>\n<p>\u3053\u3053\u307e\u3067\u7a3c\u50cd\u6642\u9593\u3092\u77ed\u7e2e\u3067\u304d\u308b\u3068\u3001\u96fb\u6e90\u96fb\u5727\u6e2c\u5b9a\u306e\u305f\u3081\u306e\u5206\u5727\u62b5\u6297\u306b\u5e38\u6642\u6d41\u308c\u308b10\u03bcA\u304c\u3082\u3063\u305f\u3044\u306a\u3044\u3002+3.0V\u306eMCP1702\u3092\u4f7f\u3044\u5206\u5727\u62b5\u6297\u3092\u306a\u304f\u3057\u305f\u5834\u5408\u3001\u30b9\u30ea\u30fc\u30d7\u6642\u306e\u96fb\u6d41\u306f25\u03bcA\u3068\u306a\u308b\u306f\u305a\u306a\u306e\u3067\u30011\u6642\u9593\u3042\u305f\u308a\u306b\u4f7f\u3046\u96fb\u6c60\u5bb9\u91cf\u306f0.031mAh\u3068\u306a\u308a\u3001\u8a08\u7b97\u4e0a\u306e\u7a3c\u50cd\u65e5\u6570\u306f\u7d042554 (days) \u2252 7 (years) \u3068\u306a\u308b\u3002\u96fb\u6c60\u81ea\u4f53\u306e\u81ea\u5df1\u653e\u96fb\u3082\u3042\u308b\u304b\u3089\u3001\u3053\u3053\u307e\u3067\u306f\u3044\u304b\u306a\u3044\u3060\u308d\u3046\u3051\u3069\u3002<\/p>\n<p>\u3082\u3063\u3068\u3082\u3001ESP32\u5074\u306f\u5e38\u6642\u901a\u96fb\u3057\u3066\u3044\u308b\u308f\u3051\u306a\u306e\u3067\u3001\u30c8\u30fc\u30bf\u30eb\u3068\u3057\u3066\u306e\u96fb\u529b\u6d88\u8cbb\u306f\u5897\u3048\u3066\u3044\u308b\u308f\u3051\u3060\u304c\u3002<\/p>\n<h3>\u518d\u9001\u30bf\u30a4\u30df\u30f3\u30b0<\/h3>\n<p>\u524d\u304b\u3089\u5206\u304b\u3063\u3066\u3044\u308b\u3053\u3068\u3060\u304c\u3001ESP8266\u306e\u30c7\u30a3\u30fc\u30d7\u30b9\u30ea\u30fc\u30d7\u306f\u6307\u5b9a\u3057\u305f\u79d2\u6570\u3088\u308a\u3082\u3061\u3087\u3063\u3068\u65e9\u304f\u30a6\u30a7\u30a4\u30af\u30a2\u30c3\u30d7\u3057\u3066\u304f\u308b\u3002\u3057\u304b\u3082\u500b\u4f53\u5dee\u304c\u3042\u308b\u3088\u3046\u3067\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30c6\u30fc\u30d6\u30eb\u306b\u6e9c\u307e\u3063\u3066\u3044\u304f\u30c7\u30fc\u30bf\u3092\u898b\u3066\u307f\u308b\u3068\u3001\u5f90\u3005\u306b\u5404\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u304b\u3089\u306e\u30c7\u30fc\u30bf\u683c\u7d0d\u6642\u523b\u306e\u5dee\u304c\u7e2e\u307e\u3063\u3066\u304d\u3066\u518d\u9001\u304c\u751f\u3058\u3066\u3044\u308b\u3053\u3068\u304c\u5206\u304b\u308b\u3002<br \/>\n\u305d\u306e\u305f\u3081\u3001\u518d\u9001\u304c\u5fc5\u8981\u306b\u306a\u3063\u305f\u3068\u304d\u306f\u5c11\u3057\u305a\u3064\u30b9\u30ea\u30fc\u30d7\u6642\u9593\u3092\u5ef6\u3070\u3059\u3053\u3068\u3067\u5bfe\u51e6\u3057\u3066\u307f\u305f\u3002\u8907\u6570\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u304c\u540c\u6642\u306b\u518d\u9001\u72b6\u614b\u306b\u306a\u3063\u305f\u3068\u304d\u3001\u304a\u306e\u304a\u306e\u304c\u540c\u3058\u6642\u9593\u3060\u3051\u9001\u4fe1\u30bf\u30a4\u30df\u30f3\u30b0\u3092\u305a\u3089\u3057\u305f\u306e\u3067\u306f\u518d\u9001\u72b6\u614b\u3092\u629c\u3051\u51fa\u305b\u306a\u3044\u3068\u8003\u3048\u3089\u308c\u308b\u306e\u3067\u3001random(); \u306b\u3088\u3063\u3066\u5e45\u3092\u4e0e\u3048\u3066\u307f\u305f\u3002<\/p>\n<p>\u5404\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u3092\u958b\u59cb\u3059\u308b\u30bf\u30a4\u30df\u30f3\u30b0\u304c\u6700\u521d\u304b\u3089\u305a\u308c\u3066\u3044\u308b\u3068\u3001\u306a\u304b\u306a\u304b\u518d\u9001\u306b\u306a\u3089\u306a\u3044\u306e\u3067\u3001\u3057\u3070\u3089\u304f\u30b9\u30ec\u30fc\u30d6\u5074\u3092\u6b62\u3081\u3066\u5168\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u304c\u4e00\u6589\u306b\u9001\u4fe1\u3092\u8a66\u307f\u308b\u72b6\u6cc1\u3092\u4f5c\u3063\u3066\u52d5\u4f5c\u3092\u78ba\u8a8d\u3057\u305f\u3002<\/p>\n<h3>\u6709\u7ddaLAN\u3092\u4f7f\u3044\u305f\u3044<\/h3>\n<p>\u30b9\u30ec\u30fc\u30d6\u5074\u306f\u3001\u30c7\u30fc\u30bf\u3092\u30b5\u30fc\u30d0\u30fc\u306b\u9001\u308b\u524d\u306bESP-NOW\u3092\u505c\u6b62\u3057\u901a\u5e38\u306eWiFi\u30b9\u30c6\u30fc\u30b7\u30e7\u30f3\u3068\u3057\u3066\u52d5\u4f5c\u3059\u308b\u3002\u3057\u305f\u304c\u3063\u3066\u3001\u3053\u306e\u9593(\u7d043\u79d2\u9593)\u306f\u53d7\u4fe1\u4e0d\u80fd\u72b6\u614b\u3068\u306a\u308b\u3002\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u5074\u304c\u3053\u306e\u30bf\u30a4\u30df\u30f3\u30b0\u306b\u30c7\u30fc\u30bf\u3092\u9001\u308d\u3046\u3068\u3059\u308b\u3068\u5fc5\u7136\u7684\u306b\u9001\u4fe1\u30a8\u30e9\u30fc\u306b\u306a\u308b\u3002\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u306e\u6570\u304c\u5897\u3048\u3066\u3044\u3051\u3070\u3001\u53d7\u4fe1\u4e0d\u80fd\u6642\u9593\u304c\u3069\u3093\u3069\u3093\u5897\u3048\u3066\u3057\u307e\u3046\u306e\u306f\u5fc5\u5b9a\u3002<\/p>\n<p>\u3053\u306e3\u79d2\u9593\u304c\u3082\u3063\u305f\u3044\u306a\u3044\u306e\u3067\u3001<em>WiFi.mode(WIFI_STA_AP);<\/em> \u3068\u3057\u3066\u3001\u6700\u521d\u306b\u30eb\u30fc\u30bf\u30fc\u306b\u63a5\u7d9a\u3057\u3066\u304b\u3089ESP-NOW\u3092\u958b\u59cb\u3057\u3066\u307f\u305f\u306e\u3060\u304c\u3001ESP-NOW\u306eAPI\u547c\u51fa\u3057(\u00a0<em>esp_now_init();<\/em>\u00a0\u306a\u3069)\u306f\u6210\u529f\u3059\u308b\u3082\u306e\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u304b\u3089\u306e\u9001\u4fe1\u306f\u3059\u3079\u3066\u5931\u6557\u3057\u3066\u3057\u307e\u3046\u3002\u4eca\u306e\u3068\u3053\u308d\u901a\u5e38\u306eWiFi\u30b9\u30c6\u30fc\u30b7\u30e7\u30f3\u3068ESP-NOW\u30b9\u30ec\u30fc\u30d6\u306e\u52d5\u4f5c\u306f\u6392\u4ed6\u7684\u306b\u898b\u3048\u308b\u3002<\/p>\n<p>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e91\u53f0\u306b\u3064\u304d3\u79d2\u9593\u306eESP-NOW\u4e0d\u611f\u6642\u9593\u3092\u306a\u304f\u3059\u305f\u3081\u306e\u65b9\u6cd5\u3068\u3057\u3066\u306f\u3001\u30b9\u30ec\u30fc\u30d6\u5074\u306fSPI\u63a5\u7d9a\u306e\u6709\u7ddaLAN\u3067\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u306b\u51fa\u308c\u308b\u3088\u3046\u306b\u3057\u3066\u304a\u304f\u306e\u304c\u826f\u3055\u305d\u3046\u306b\u601d\u3048\u308b\u3002\u3069\u3046\u305bAC\u30a2\u30c0\u30d7\u30bf\u3092\u4f7f\u3063\u3066\u3044\u308b\u3057\u3001ESP32\u306e\u30d1\u30ef\u30fc\u306f\u6709\u308a\u4f59\u3063\u3066\u3044\u308b\u3002\u6bce\u5ea6\u30a2\u30af\u30bb\u30b9\u30dd\u30a4\u30f3\u30c8\u63a5\u7d9a\u3059\u308b\u3088\u308a\u3082\u901f\u3084\u304b\u306b\u30b5\u30fc\u30d0\u30fc\u3078\u306e\u9001\u4fe1\u304c\u7d42\u308f\u308b\u3053\u3068\u304c\u671f\u5f85\u3067\u304d\u308b\u3002<\/p>\n<h3>\u30b7\u30ea\u30a2\u30eb\u30e2\u30cb\u30bf\u51fa\u529b\u306e\u6291\u6b62<\/h3>\n<p>\u5c0f\u30cd\u30bf\u3068\u3057\u3066\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u3001\u30b9\u30ec\u30fc\u30d6\u3068\u3082\u306b\u3001\u30b7\u30ea\u30a2\u30eb\u30e2\u30cb\u30bf\u95a2\u4fc2\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30de\u30af\u30ed\u3067\u5b9a\u7fa9\u3057\u3066\u3044\u308b\u3002<\/p>\n<pre class=\"lang:default decode:true\">#define SERIAL_MONITOR  1\r\n#if SERIAL_MONITOR\r\n#define START_MSG \"\\n\" + String(__FILE__) + \" start.\\n\"\r\n#define SERIAL_INIT(a) Serial.begin(a)\r\n#define SERIAL_OUT(a) Serial.print(a)\r\n#define SERIAL_F(...) Serial.printf(__VA_ARGS__)\r\n#else\r\n#define START_MSG\r\n#define SERIAL_INIT(a) \r\n#define SERIAL_OUT(a) \r\n#define SERIAL_F(...) \r\n#endif<\/pre>\n<p><span class=\"lang:default decode:true crayon-inline\">#define SERIAL_MONITO 0 <\/span>\u00a0\u3068\u3059\u308c\u3070\u3001Serial\u306e\u5ba3\u8a00\u3082\u521d\u671f\u5316\u3082\u306a\u304f\u306a\u308b\u3057\u3001\u30e2\u30cb\u30bf\u51fa\u529b\u7528\u306e\u547c\u3073\u51fa\u3057\u3082\u6d88\u3048\u3066\u306a\u304f\u306a\u308b\u304b\u3089\u30e1\u30e2\u30ea\u306e\u7bc0\u7d04\u306b\u306a\u308b\u3002<\/p>\n<p>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u5074\u306b\u306f\u305d\u308c\u4ee5\u4e0a\u306e\u52b9\u679c\u304c\u3042\u3063\u3066\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30c6\u30fc\u30d6\u30eb\u306eX1\u30ab\u30e9\u30e0\u306b\u683c\u7d0d\u3055\u308c\u308b\u7a3c\u50cd\u6642\u9593 (<em>sensor_data_t.elapsed<\/em>) \u304c\u7d046\uff5e7msec \u77ed\u7e2e\u3055\u308c\u308b\u3002\u3064\u307e\u308a\u3001WiFi\u7a3c\u50cd\u6642\u9593\u309220%\u7a0b\u5ea6\u6e1b\u3089\u3059\u3053\u3068\u304c\u3067\u304d\u308b\u3002\u30b9\u30ec\u30fc\u30d6\u5074\u3067\u306f\u5927\u3057\u305f\u610f\u5473\u3092\u3082\u305f\u306a\u3044\u304c\u3001\u96fb\u6c60\u3067\u52d5\u304b\u3059\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u5074\u3067\u306f\u4fa1\u5024\u304c\u3042\u308b\u3060\u308d\u3046\u3002\u5f53\u7136\u306a\u304c\u3089\u3001\u30b7\u30ea\u30a2\u30eb\u30b1\u30fc\u30d6\u30eb\u3092\u63a5\u7d9a\u3057\u3066\u3044\u306a\u3044\u72b6\u614b\u3067\u306e\u8a71\u3002<\/p>\n<h1>\u304d\u3087\u3046\u306e\u307e\u3068\u3081<\/h1>\n<p>\u3061\u3087\u3063\u3068\u524d\u306b\u66f8\u3044\u305f\u3001\u300c<a href=\"https:\/\/okiraku-camera.tokyo\/blog\/?p=6958\">WROOM-02\u3068BME280 \u96fb\u6c60\u99c6\u52d5\u3067\u6e29\u5ea6\u6e2c\u5b9a\u306e\u6539\u8a02\u7248<\/a>\u300d\u306e\u7d9a\u304d\u3068\u3057\u3066\u3001\u6e29\u5ea6\u5909\u5316\u306e\u8a55\u4fa1\u306b\u3088\u3063\u3066WiFi\u3092\u4f7f\u3046\u56de\u6570\u3092\u6e1b\u3089\u3057\u3066\u96fb\u6c60\u306e\u30e2\u30c1\u3092\u3088\u304f\u3059\u308b\u8a71\u3092\u66f8\u3044\u3066\u3044\u305f\u306e\u3060\u3051\u3069\u3001ESP-NOW \u3092\u8a66\u3057\u3066\u307f\u305f\u3089\u5287\u7684\u306bWiFi\u7a3c\u50cd\u6642\u9593\u3092\u77ed\u7e2e\u3067\u304d\u305f\u306e\u3067\u3053\u3061\u3089\u3092\u5148\u306b\u63b2\u8f09\u3057\u305f\u3002\u6e29\u5ea6\u5909\u5316\u3092\u8a55\u4fa1\u3059\u308b\u65b9\u5f0f\u306f3\u6708\u306e\u521d\u3081\u304b\u30892\u30f6\u6708\u307b\u3069\u52d5\u3044\u3066\u3044\u308b\u304c\u3001\u96fb\u6e90\u96fb\u5727\u306e\u4f4e\u4e0b\u5ea6\u5408\u3044\u306f\u671f\u5f85\u901a\u308a\u306b\u3086\u308b\u3084\u304b\u3067\u3042\u308b\u3002ESP-NOW\u3068\u7d44\u307f\u5408\u308f\u305b\u308b\u3053\u3068\u3067\u3001\u96fb\u6c60\u306e\u672c\u6570\u3092\u6e1b\u3089\u3059\u3068\u304b\u3001\u3082\u3063\u3068\u5bb9\u91cf\u306e\u5c0f\u3055\u306a\u96fb\u6c60\u3092\u4f7f\u3046\u3068\u3044\u3063\u305f\u65b9\u5411\u6027\u304c\u898b\u3048\u3066\u304f\u308b\u3002<\/p>\n<p>\u4eca\u306e\u3068\u3053\u308d1\u6642\u9593\u3042\u305f\u308a60\u56de\u3082\u6e2c\u5b9a\u3068\u9001\u4fe1\u3092\u304a\u3053\u306a\u3063\u3066\u3044\u308b\u304b\u3089\u30011\u9031\u9593\u5b89\u5b9a\u3057\u3066\u52d5\u3044\u3066\u304f\u308c\u308c\u307010,000\u884c\u4ee5\u4e0a\u306e\u30c7\u30fc\u30bf\u304c\u6e9c\u307e\u308b\u306f\u305a\u3067\u3042\u308b\u3002\u305f\u3060\u3001\u30dc\u30fc\u30c9\u306e\u5834\u6240\u3092\u5909\u3048\u308b\u3068\u304d\u306b\u96fb\u6e90\u30b1\u30fc\u30d6\u30eb\u304c\u629c\u3051\u308b\u3068\u304b\u30d6\u30ec\u30c3\u30c9\u30dc\u30fc\u30c9\u306b\u523a\u3057\u305f\u30b1\u30fc\u30d6\u30eb\u306e\u63a5\u89e6\u304c\u60aa\u5316\u3059\u308b\u3068\u304b\u306e\u7406\u7531\u3067\u96fb\u6e90\u96fb\u5727\u304c\u4f4e\u4e0b\u3057\u3066\u6b62\u307e\u3063\u3066\u3057\u307e\u3063\u305f\u308a\u3059\u308b\u306e\u304c\u56f0\u308a\u3082\u306e\u3002<br \/>\n\u3044\u3061\u304a\u3046\u30b9\u30b1\u30c3\u30c1\u304c\u56fa\u307e\u3063\u305f\u306e\u3067\u3042\u308b\u7a0b\u5ea6\u9023\u7d9a\u7a3c\u50cd\u3055\u305b\u3001\u30c7\u30fc\u30bf\u304c\u305f\u307e\u3063\u305f\u6642\u70b9\u3067\u30ea\u30c8\u30e9\u30a4\u306e\u767a\u751f\u983b\u5ea6\u3084\u30ea\u30c8\u30e9\u30a4\u3092\u542b\u3081\u305f\u5e73\u5747\u7a3c\u50cd\u6642\u9593\u3068\u3044\u3063\u305f\u7d71\u8a08\u7684\u306a\u3082\u306e\u3092\u8ffd\u8a18\u3057\u3066\u3044\u304f\u4e88\u5b9a\u3067\u3059\u3002<\/p>\n<h1>\u8ffd\u8a181(\u6709\u7ddaLAN)<\/h1>\n<p>ESP-WROOM-02D\u306bSPI-Ethernet\u30e2\u30b8\u30e5\u30fc\u30eb\u306eUSR-ES1\u3092\u63a5\u7d9a\u3057\u3001ESP8266\u7528\u306eESP-NOW\u30b9\u30ec\u30fc\u30d6\u3092\u5b9f\u88c5\u3057\u3066\u307f\u305f\u3068\u3053\u308d\u3001\u671f\u5f85\u901a\u308a\u306b\u30b5\u30fc\u30d0\u30fc\u3078\u306e\u30c7\u30fc\u30bf\u8ee2\u9001\u6642\u9593\u3092\u77ed\u7e2e\u3067\u304d\u305f\u3002loop(); \u5185\u3067\u306e\u53d7\u4fe1\u691c\u51fa\u304b\u3089\u30b5\u30fc\u30d0\u30fc\u3078\u306e\u9001\u4fe1\u5b8c\u4e86\u307e\u3067\u306e\u6240\u7528\u6642\u9593\u306f100msec\u524d\u5f8c\u306b\u306a\u3063\u305f\u3002<\/p>\n<p>ESP-NOW\u306e\u30b9\u30ec\u30fc\u30d6\u6a5f\u80fd\u306b\u3064\u3044\u3066\u3082\u3001ESP32\u7528\u3068\u307b\u307c\u540c\u3058\u30b9\u30b1\u30c3\u30c1\u3067\u52d5\u4f5c\u3057\u305f\u3002Ethernet\u30e2\u30b8\u30e5\u30fc\u30eb+ESP8266\u7528\u306eESP-NOW\u30b9\u30ec\u30fc\u30d6\u306b\u3064\u3044\u3066\u306f\u5225\u7a3f\u3068\u3057\u3066\u307e\u3068\u3081\u308b\u4e88\u5b9a\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6982\u8981 Espressif\u793e\u304c\u958b\u767a\u3057\u305fESP-NOW\u306f\u3001IEEE802.11\u306eMAC\u30d5\u30ec\u30fc\u30e0\u306e\u4e00\u7a2e\u3067\u3042\u308b\u30a2\u30af\u30b7\u30e7\u30f3\u30d5\u30ec\u30fc\u30e0\u3092\u4f7f\u3063\u3066Espressif\u793e\u306eWiFi\u30c7\u30d0\u30a4\u30b9\u9593\u3067\u30c7\u30fc\u30bf\u3092\u9001\u53d7\u4fe1\u3059\u308b\u305f\u3081\u306e\u72ec\u81ea\u6280\u8853\u3067\u3001ESP-WRO &hellip; <a href=\"https:\/\/okiraku-camera.tokyo\/blog\/?p=7167\" class=\"more-link\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">ESP8266\u3068ESP32 \u6e29\u5ea6\u6e2c\u5b9a\u306bESP-NOW\u3092\u4f7f\u3063\u3066\u307f\u308b<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[69],"tags":[65,84,70],"class_list":["post-7167","post","type-post","status-publish","format-standard","hentry","category-programming","tag-arduino","tag-esp32","tag-esp8266"],"_links":{"self":[{"href":"https:\/\/okiraku-camera.tokyo\/blog\/index.php?rest_route=\/wp\/v2\/posts\/7167","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/okiraku-camera.tokyo\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/okiraku-camera.tokyo\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/okiraku-camera.tokyo\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/okiraku-camera.tokyo\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7167"}],"version-history":[{"count":0,"href":"https:\/\/okiraku-camera.tokyo\/blog\/index.php?rest_route=\/wp\/v2\/posts\/7167\/revisions"}],"wp:attachment":[{"href":"https:\/\/okiraku-camera.tokyo\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7167"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/okiraku-camera.tokyo\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7167"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/okiraku-camera.tokyo\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7167"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}