{"id":3575,"date":"2021-11-20T11:22:11","date_gmt":"2021-11-20T02:22:11","guid":{"rendered":"https:\/\/www.ekit-tech.com\/?p=3575"},"modified":"2024-01-26T12:18:14","modified_gmt":"2024-01-26T03:18:14","slug":"%e3%80%90esp32%e3%80%91%e7%89%b9%e5%ae%9a%e3%81%ae%e9%9f%b3%e3%81%8c%e9%b3%b4%e3%81%a3%e3%81%9f%e3%82%89line%e3%81%a7%e9%80%9a%e7%9f%a5%e3%81%99%e3%82%8b%ef%bc%88%e3%81%94%e9%a3%af%e3%82%88%e3%80%9c","status":"publish","type":"post","link":"https:\/\/www.ekit-tech.com\/?p=3575","title":{"rendered":"\u3010ESP32\u3011\u7279\u5b9a\u306e\u97f3\u304c\u9cf4\u3063\u305f\u3089LINE\u3067\u901a\u77e5\u3059\u308b\uff08\u3054\u98ef\u3088\u301c\uff01\u3092\u5bb6\u65cf\u5168\u54e1\u306b\u304a\u77e5\u3089\u305b\u30b7\u30b9\u30c6\u30e0\uff09"},"content":{"rendered":"\n<p>\u4eca\u56de\u306f\u3001ESP32-DevKitC\u3092\u4f7f\u3063\u305f\u300c\u7279\u5b9a\u306e\u97f3\u304c\u9cf4\u3063\u305f\u3089LINE\u3067\u901a\u77e5\u3059\u308b\u30b7\u30b9\u30c6\u30e0\u300d\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><span class=\"unber\">\u300c\u97f3\u304c\u5c4a\u304b\u306a\u3044\u3068\u3053\u308d\u306b\u3044\u308b\u4eba\u306b\u3082\u3001\u97f3\u304c\u9cf4\u3063\u305f\u3053\u3068\u3092\u77e5\u3089\u305b\u305f\u3044\u300d<\/span><\/p>\n\n\n\n<p><span class=\"unber\">\u300c\u65e2\u5b58\u306e\u88c5\u7f6e\u3092\u6539\u9020\u305b\u305a\u306b\u3001LINE\u3067\u901a\u77e5\u3059\u308b\u30b7\u30b9\u30c6\u30e0\u3092\u53d6\u308a\u4ed8\u3051\u305f\u3044\u300d<\/span><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\u3068\u3044\u3046\u65b9\u3001\u305c\u3072\u53c2\u8003\u306b\u3057\u3066\u307f\u3066\u4e0b\u3055\u3044\u3002<\/p>\n\n\n\n<p><figure class=\"wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper youtube\"><iframe src=\"https:\/\/www.youtube.com\/embed\/vHgSYzLh0ow\"><\/iframe><\/div><\/figure><\/p>\n\n\n\n<p>\u547c\u3073\u51fa\u3057\u30dc\u30bf\u30f3\u306e\u300c\u30d4\u30f3\u30dd\u30fc\u30f3\u300d\u3068\u3044\u3046\u97f3\u304c\u30c8\u30ea\u30ac\u30fc\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3042\u3089\u304b\u3058\u3081\u8a2d\u5b9a\u3057\u3066\u304a\u3044\u305f\u97f3\u3068\u540c\u3058\u97f3\u3060\u3068\u5224\u65ad\u3055\u308c\u308b\u3068\u3001LINE\u30b0\u30eb\u30fc\u30d7\u306b\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u914d\u4fe1\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<\/div><h2><strong>\u76ee\u6b21<\/strong><\/h2><div class=\"inner\">\n\n\n\n<ol><li><a href=\"#parts\">\u4f7f\u7528\u30d1\u30fc\u30c4<\/a><\/li><li><a href=\"#cir\">\u914d\u7dda\u30fb\u56de\u8def\u56f3<\/a><\/li><li><a href=\"#pg\">\u30d7\u30ed\u30b0\u30e9\u30e0<\/a><\/li><li><a href=\"#com\">\u6280\u8853\u89e3\u8aac<\/a><\/li><li><a href=\"#ex\">\u4f7f\u7528\u4f8b<\/a><\/li><\/ol>\n\n\n\n<\/div><h2 id=\"parts\"><strong>\u4f7f\u7528\u30d1\u30fc\u30c4<\/strong><\/h2><div class=\"inner\">\n\n\n\n<ul><li><a href=\"https:\/\/www.amazon.co.jp\/gp\/product\/B08B857KCP\/ref=as_li_tl?ie=UTF8&amp;camp=247&amp;creative=1211&amp;creativeASIN=B08B857KCP&amp;linkCode=as2&amp;tag=kouryuudou-22&amp;linkId=02bff5126e9bc9bad9f67adea7580d4d\">VKLSVAN\u00a0 \u30b5\u30a6\u30f3\u30c9\u30bb\u30f3\u30b5\u30fc\u30e2\u30b8\u30e5\u30fc\u30eb\uff08LM393\u30c1\u30c3\u30d7\uff09\uff0d Amazon<\/a><\/li><li><a href=\"https:\/\/www.amazon.co.jp\/gp\/product\/B086QKRY25\/ref=as_li_tl?ie=UTF8&amp;camp=247&amp;creative=1211&amp;creativeASIN=B086QKRY25&amp;linkCode=as2&amp;tag=kouryuudou-22&amp;linkId=d146cc56caa9a04cd9c366d0efae9cfb\">WayinTop ESP32\uff08ESP-WROOM-32\uff09\uff0d Amazon<\/a><\/li><li>\u30ab\u30fc\u30dc\u30f3\u62b5\u6297 100\u03a9\uff081W\uff09 \u30fb\u30fb\u30fb 2\u500b<\/li><li><a href=\"https:\/\/akizukidenshi.com\/catalog\/g\/g108896\">I2C\u63a5\u7d9aLCD\u30e2\u30b8\u30e5\u30fc\u30eb\uff08AE-AQM1602A-KIT\uff09\uff0d \u79cb\u6708\u96fb\u5b50<\/a><\/li><\/ul>\n\n\n\n<\/div><h2 id=\"cir\"><strong>\u914d\u7dda\u30fb\u56de\u8def\u56f3<\/strong><\/h2><div class=\"inner\">\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-1.jpg\"><img src=\"https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-1-1200x675.jpg\" alt=\"\u3010ESP32\u3011\u7279\u5b9a\u306e\u97f3\u304c\u9cf4\u3063\u305f\u3089LINE\u3067\u901a\u77e5\u306e\u914d\u7dda\u30fb\u56de\u8def\u56f3\" class=\"wp-image-3626\"\/><\/a><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-4.jpg\"><img src=\"https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-4-1200x675.jpg\" alt=\"\u7279\u5b9a\u306e\u97f3\u304c\u9cf4\u3063\u305f\u3089LINE\u3067\u901a\u77e5\u3059\u308b\u88c5\u7f6e\" class=\"wp-image-3699\"\/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-5.jpg\"><img loading=\"lazy\" width=\"1200\" height=\"675\" src=\"https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-5-1200x675.jpg\" alt=\"\u57fa\u677f\uff08\u90e8\u54c1\u5b9f\u88c5\u9762\uff09\" class=\"wp-image-3703\" srcset=\"https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-5-1200x675.jpg 1200w, https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-5-300x169.jpg 300w, https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-5-768x432.jpg 768w, https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-5.jpg 1280w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-6.jpg\"><img loading=\"lazy\" width=\"1200\" height=\"675\" src=\"https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-6-1200x675.jpg\" alt=\"\u57fa\u677f\uff08\u914d\u7dda\u9762\uff09\" class=\"wp-image-3704\" srcset=\"https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-6-1200x675.jpg 1200w, https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-6-300x169.jpg 300w, https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-6-768x432.jpg 768w, https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-6.jpg 1280w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/a><\/figure>\n\n\n\n<\/div><h2 id=\"pg\"><strong>\u30d7\u30ed\u30b0\u30e9\u30e0<\/strong><\/h2><div class=\"inner\">\n\n\n\n<p>\u4ee5\u4e0b\u306e\u5909\u6570\u306f\u5404\u81ea\u66f8\u304d\u63db\u3048\u3066\u4e0b\u3055\u3044\u2193<\/p>\n\n\n\n<ol><li>ssid<\/li><li>password<\/li><li>token<\/li><li>message<\/li><\/ol>\n\n\n\n<p><\/p>\n\n\n\n<p class=\"has-vivid-red-color has-text-color\">\u203b\u4e8b\u524d\u306bLINE Notify\u306e\u767b\u9332\u3092\u884c\u3044\u3001\u30c8\u30fc\u30af\u30f3\u3092\u767a\u884c\u3057\u3066\u304a\u304f\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u8a73\u3057\u304f\u306f\u3001\u4e0b\u8a18\u306e\u8a18\u4e8b\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u2193<\/p>\n\n\n\n<p><a href=\"https:\/\/www.ekit-tech.com\/?p=3434\">\u3010ESP32\u3011\u30dc\u30bf\u30f3\u3092\u62bc\u3057\u305f\u3089LINE\u901a\u77e5<\/a><\/p>\n\n\n\n<p><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;WiFi.h&gt;\n#include &lt;WiFiClientSecure.h&gt;\n#include&lt;Wire.h&gt;\n\n\/\/ WiFi\u8a2d\u5b9a\nconst char* ssid     = \"your-ssid\";\nconst char* password = \"your-password\";\n\n\/\/ LINE Notify\u8a2d\u5b9a\nconst char* host = \"notify-api.line.me\";\nconst char* token = \"your-token\";\nconst char* message = \"\u30d4\u30f3\u30dd\u30fc\u30f3\uff01\";\n\n\/\/ \u30b5\u30a6\u30f3\u30c9\u30bb\u30f3\u30b5\u30fc\u306b\u4f7f\u7528\u3059\u308bPin\nint sensor_pin = 15;\n\n\/\/ I2C\u30a2\u30c9\u30ec\u30b9\uff08LCD\u306e\u30b9\u30ec\u30fc\u30d6\u5024\u3092\u8a2d\u5b9a\uff09\n#define LCD_ADRS 0x3E\n\nvoid setup() {\n\n  \/\/ \u30bb\u30f3\u30b5\u30fc\u306b\u4f7f\u7528\u3059\u308bPin\u3092\u5165\u529b\u306b\u8a2d\u5b9a\n  pinMode(sensor_pin, INPUT);\n\n  \/\/ LCD\u30c7\u30a3\u30b9\u30d7\u30ec\u30a4\u8868\u793a\u306b\u4f7f\u7528\u3059\u308bI2C\u7528Pin\u306e\u8a2d\u5b9a\n  Wire.begin(21,22);\n\n  \/\/ \u30b7\u30ea\u30a2\u30eb\u30e2\u30cb\u30bf\u306e\u901a\u4fe1\u901f\u5ea6\n  Serial.begin(115200);\n  \n  Serial.println();\n  Serial.print(\"Connecting to \");\n  Serial.println(ssid);\n\n  \/\/ WiFi\u63a5\u7d9a\n  WiFi.begin(ssid, password);\n\n  \/\/ WiFi\u306e\u63a5\u7d9a\u72b6\u614b\u3092\u78ba\u8a8d\n  while (WiFi.status() != WL_CONNECTED) {\n      delay(500);\n      Serial.print(\".\");\n  }\n\n  Serial.println(\"\");\n  Serial.println(\"WiFi connected.\");\n  Serial.println(\"IP address: \");\n  Serial.println(WiFi.localIP());\n  \n}\n\n\/\/ line\u901a\u77e5\nvoid send_line() {\n\n  \/\/ HTTPS\u3078\u30a2\u30af\u30bb\u30b9\uff08SSL\u901a\u4fe1\uff09\u3059\u308b\u305f\u3081\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\n  WiFiClientSecure client;\n\n  \/\/ \u30b5\u30fc\u30d0\u30fc\u8a3c\u660e\u66f8\u306e\u691c\u8a3c\u3092\u884c\u308f\u305a\u306b\u63a5\u7d9a\u3059\u308b\u5834\u5408\u306b\u5fc5\u8981\n  client.setInsecure();\n  \n  Serial.println(\"Try\");\n  \n  \/\/Line\u306eAPI\u30b5\u30fc\u30d0\u306bSSL\u63a5\u7d9a\uff08\u30dd\u30fc\u30c8443:https\uff09\n  if (!client.connect(host, 443)) {\n    Serial.println(\"Connection failed\");\n    return;\n  }\n  Serial.println(\"Connected\");\n\n  \/\/ \u30ea\u30af\u30a8\u30b9\u30c8\u9001\u4fe1\n  String query = String(\"message=\") + String(message);\n  String request = String(\"\") +\n               \"POST \/api\/notify HTTP\/1.1\\r\\n\" +\n               \"Host: \" + host + \"\\r\\n\" +\n               \"Authorization: Bearer \" + token + \"\\r\\n\" +\n               \"Content-Length: \" + String(query.length()) +  \"\\r\\n\" + \n               \"Content-Type: application\/x-www-form-urlencoded\\r\\n\\r\\n\" +\n                query + \"\\r\\n\";\n  client.print(request);\n \n  \/\/ \u53d7\u4fe1\u5b8c\u4e86\u307e\u3067\u5f85\u6a5f \n  while (client.connected()) {\n    String line = client.readStringUntil('\\n');\n    if (line == \"\\r\") {\n      break;\n    }\n  }\n  \n  String line = client.readStringUntil('\\n');\n  Serial.println(line);\n}\n\n\/\/ \u7a3c\u50cd\u6642\u9593\nunsigned long uptime;\n\n\/\/ \u4e00\u3064\u306e\u97f3\u306e\u59cb\u307e\u308a\u304b\u3089\u7d42\u308f\u308a\u307e\u3067\u306e\u7dcf\u6642\u9593\nint total_time = 0;\n\n\/\/ \u30b5\u30a6\u30f3\u30c9\u30bb\u30f3\u30b5\u306e\u4fe1\u53f7\u304cHIGH\u3092\u793a\u3057\u3066\u3044\u305f\u7dcf\u6642\u9593\nint high_total_time = 0;\n\n\/\/ \u30b5\u30a6\u30f3\u30c9\u30bb\u30f3\u30b5\u306e\u4fe1\u53f7\u304cLOW\u3092\u793a\u3057\u3066\u3044\u305f\u6642\u9593\nint low_time;\n\n\/\/ \u97f3\u306e\u7d42\u308f\u308a\u3068\u5224\u65ad\u3059\u308b\u305f\u3081\u306e\u7121\u97f3\u6642\u9593\uff08us\uff09\nint limit_time = 1000000;\n\n\/\/ \u4fe1\u53f7\u304cHIGH\u306b\u306a\u3063\u305f\u77ac\u9593\u306e\u6642\u9593\u3092\u8a18\u9332\uff08\u6700\u521d\u306e\u4e00\u56de\u306e\u307f\uff09\nint first_rise_point;\n\n\/\/ \u4fe1\u53f7\u304cHIGH\u306b\u306a\u3063\u305f\u77ac\u9593\u306e\u6642\u9593\u3092\u8a18\u9332\nint rise_point;\n\n\/\/ \u4fe1\u53f7\u304cLOW\u306b\u306a\u3063\u305f\u77ac\u9593\u306e\u6642\u9593\u3092\u8a18\u9332\nint fall_point;\n\n\/\/ HIGH\u4fe1\u53f7\u304c\u7d99\u7d9a\u3057\u3066\u3044\u308b\u3068\u304d\u306e\u30d5\u30e9\u30b0\nint high_state = 0;\n\n\/\/ LOW\u4fe1\u53f7\u304c\u7d99\u7d9a\u3057\u3066\u3044\u308b\u3068\u304d\u306e\u30d5\u30e9\u30b0\nint low_state = 0;\n\n\/\/ \u4fe1\u53f7\u304cHIGH\u306b\u306a\u3063\u305f\u56de\u6570\nint cnt = 0;\n\n\/\/ \u30bb\u30f3\u30b5\u30fc\u306e\u5024\nint sensor_val;\n\n\nvoid loop() {\n\n  \/\/ \u30de\u30a4\u30b3\u30f3\u306e\u7a3c\u50cd\u6642\u9593\uff08us\uff09\n  uptime = micros();\n\n  \/\/ \u30bb\u30f3\u30b5\u30fc\u306e\u5024\u3092\u8aad\u307f\u53d6\u308b\n  sensor_val =  digitalRead(sensor_pin);\n\n  \/\/ \u30bb\u30f3\u30b5\u30fc\u306e\u5024\u304cHIGH\u306e\u3068\u304d\n  if (sensor_val == 1) {\n\n    \/\/ LOW\u4fe1\u53f7\u306e\u7d99\u7d9a\u30d5\u30e9\u30b0\u3092\u89e3\u9664\n    low_state = 0;\n\n    \/\/ \u4fe1\u53f7\u304cHIGH\u306b\u306a\u3063\u305f\u77ac\u9593\uff08\u7acb\u3061\u4e0a\u304c\u308a\uff09\n    if (high_state == 0) {\n\n      \/\/ HIGH\u4fe1\u53f7\u306e\u7d99\u7d9a\u30d5\u30e9\u30b0\u3092\u7acb\u3066\u308b\n      high_state = 1;\n\n      \/\/ \u4fe1\u53f7\u304cHIGH\u306b\u306a\u3063\u305f\u77ac\u9593\u306e\u6642\u9593\u3092\u8a18\u9332\n      rise_point = uptime;\n\n      \/\/ \u30d1\u30eb\u30b9\u306e\u6570\u3092\u6570\u3048\u308b\n      cnt = cnt + 1;\n\n      \/\/ \u4e00\u3064\u306e\u97f3\u306e\u9577\u3055\u3092\u6c42\u3081\u308b\u305f\u3081\u306e\u6e96\u5099\n      if (cnt == 1) {\n        \n        \/\/ \u4e00\u3064\u306e\u97f3\u306e\u59cb\u307e\u308a\u3068\u306a\u308b\u6642\u9593\u3092\u8a18\u9332\n        first_rise_point = uptime;\n        \n      }\n\n    }\n    \n  \/\/ \u30bb\u30f3\u30b5\u30fc\u306e\u5024\u304cLOW\u306e\u3068\u304d\n  } else {\n\n   \/\/ HIGH\u4fe1\u53f7\u306e\u7d99\u7d9a\u30d5\u30e9\u30b0\u3092\u89e3\u9664\n    high_state = 0;\n\n    \/\/ \u4fe1\u53f7\u304cLOW\u306b\u306a\u3063\u305f\u77ac\u9593\uff08\u7acb\u3061\u4e0b\u304c\u308a\uff09\n    if (low_state == 0) {\n\n       \/\/ LOW\u4fe1\u53f7\u306e\u7d99\u7d9a\u30d5\u30e9\u30b0\u3092\u7acb\u3066\u308b\n      low_state = 1;\n\n      \/\/ \u4fe1\u53f7\u304cLOW\u306b\u306a\u3063\u305f\u77ac\u9593\u306e\u6642\u9593\u3092\u8a18\u9332\n      fall_point = uptime;\n\n      \/\/ \u30b5\u30a6\u30f3\u30c9\u30bb\u30f3\u30b5\u306e\u4fe1\u53f7\u304cHIGH\u3092\u793a\u3057\u3066\u3044\u305f\u7dcf\u6642\u9593\u3092\u8a08\u6e2c\n      high_total_time = high_total_time + (uptime - rise_point);\n\n    \/\/ LOW\u4fe1\u53f7\u306e\u7d99\u7d9a\n    } else {\n\n      \/\/ LOW\u4fe1\u53f7\u306e\u6642\u9593\u3092\u8a08\u6e2c\uff08\u7a3c\u50cd\u6642\u9593 - \u4fe1\u53f7\u304cLOW\u306b\u306a\u3063\u305f\u77ac\u9593\u306e\u6642\u9593\uff09\n      low_time = uptime - fall_point;\n\n      \/\/ \u97f3\u306e\u7d42\u308f\u308a\u3068\u5224\u65ad\u3057\u305f\u5834\u5408\uff08\u7121\u97f3\u306e\u6642\u9593\u304c\u7d9a\u3044\u305f\uff09\n      if (low_time &gt; limit_time) {\n\n        \/\/ \u305a\u3063\u3068\u7121\u97f3\u72b6\u614b\u3060\u3063\u305f\u3068\u304d\u306f\u51e6\u7406\u3057\u306a\u3044\n        if (cnt &gt; 0) {\n\n          \/\/ \u97f3\u306e\u59cb\u307e\u308a\u304b\u3089\u7d42\u308f\u308a\u307e\u3067\u306e\u7dcf\u6642\u9593\u3092\u7b97\u51fa\n          total_time = uptime - first_rise_point - limit_time;\n\n          Serial.print(total_time);\n          Serial.print(\"&#91;\");\n          Serial.print(high_total_time);\n          Serial.print(\"]\");\n\n          \/\/ LCD\u30c7\u30a3\u30b9\u30d7\u30ec\u30a4\u306b\u8868\u793a\u3059\u308b\u305f\u3081\u306b\u6570\u5024\u3092\u6587\u5b57\u5217\u306b\u5909\u63db\n          String str_total_time = String(total_time);\n          String str_high_total_time = String(high_total_time);\n\n          \/\/ \u6587\u5b57\u5217\u3092\u4e00\u6587\u5b57\u305a\u3064\u914d\u5217\u306b\u683c\u7d0d\u3059\u308b\n          char text1&#91;16];\n          str_total_time.toCharArray(text1, 16); \n          char text2&#91;16];\n          str_high_total_time.toCharArray(text2, 16); \n\n          \/\/ LCD\u521d\u671f\u5316\n          init_LCD();\n          \n          \/\/ LCD\u30c7\u30a3\u30b9\u30d7\u30ec\u30a4\uff081\u884c\u76ee\uff09\u306b\u97f3\u306e\u7dcf\u6642\u9593\u3092\u8868\u793a\n          for(int i=0;i&lt;10;i++){\n            writeData(text1&#91;i]);\n          }\n          \/\/ LCD\u30c7\u30a3\u30b9\u30d7\u30ec\u30a4\uff082\u884c\u76ee\uff09\u306bHIGH\u306e\u7dcf\u6642\u9593\u3092\u8868\u793a\n          writeCommand(0x40+0x80);\n          for(int i=0;i&lt;10;i++){\n            writeData(text2&#91;i]);\n          }\n\n          \/\/ \u5168\u4f53\u97f3\u306e\u9577\u3055\u3067\u691c\u8a3c\n          if (total_time &gt; 3000000 &amp;&amp; total_time &lt; 4000000) {\n\n             \/\/ \u4fe1\u53f7\u304cHIGH\u306b\u306a\u3063\u305f\u3068\u304d\u306e\u7dcf\u6642\u9593\u3067\u691c\u8a3c\n             if (high_total_time &gt; 350000 &amp;&amp; high_total_time &lt; 600000) {\n              \n              Serial.println(\" HIT!\");\n\n              \/\/ Line\u306b\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u9001\u4fe1\u3059\u308b\n              send_line();\n\n             }\n            \n          }\n          \n          Serial.println(\"\");\n\n          \/\/ \u7dcf\u6642\u9593\u3092\u30ea\u30bb\u30c3\u30c8\n          total_time = 0;\n          \n        }\n\n        \/\/ \u4e00\u3064\u306e\u97f3\u306e\u8aad\u307f\u53d6\u308a\u7d42\u4e86\n        high_state = 0;\n        low_state = 0;\n        low_time = 0;\n        high_total_time = 0;\n        first_rise_point = 0;\n        rise_point = uptime;\n        fall_point = uptime;\n        cnt = 0;\n        \n      }\n    }\n  }\n}\n\n\/\/ LCD\u30c7\u30fc\u30bf\u66f8\u304d\u8fbc\u307f\nvoid writeData(byte t_data){\n  \n  Wire.beginTransmission(LCD_ADRS);\n  Wire.write(0x40);\n  Wire.write(t_data);\n  Wire.endTransmission();\n  delay(1);\n  \n}\n\n\/\/ LCD\u30b3\u30de\u30f3\u30c9\u66f8\u304d\u8fbc\u307f\nvoid writeCommand(byte t_command){\n  \n  Wire.beginTransmission(LCD_ADRS);\n  Wire.write(0x00);\n  Wire.write(t_command);\n  Wire.endTransmission();\n  delay(10);\n  \n}\n\n\/\/ LCD\u521d\u671f\u5316\nvoid init_LCD(){\n  \n  delay(100);\n  writeCommand(0x38);\n  delay(20);\n  writeCommand(0x39);\n  delay(20);\n  writeCommand(0x14);\n  delay(20);\n  writeCommand(0x73);\n  delay(20);\n  writeCommand(0x52);\n  delay(20);\n  writeCommand(0x6C);\n  delay(20);\n  writeCommand(0x38);\n  delay(20);\n  writeCommand(0x01);\n  delay(20);\n  writeCommand(0x0C);\n  delay(20);\n  \n}<\/code><\/pre>\n\n\n\n<\/div><h2 id=\"com\"><strong>\u6280\u8853\u89e3\u8aac<\/strong><\/h2><div class=\"inner\">\n\n\n\n<p>\u3055\u3089\u306b\u8a73\u3057\u304f\u89e3\u8aac\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h3><strong>\u97f3\u306e\u691c\u77e5\u30fb\u7279\u5b9a\u65b9\u6cd5<\/strong><\/h3>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1200\" height=\"675\" src=\"https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-10-1200x675.jpg\" alt=\"\u30b5\u30a6\u30f3\u30c9\u30bb\u30f3\u30b5\u30fc\u30e2\u30b8\u30e5\u30fc\u30eb\" class=\"wp-image-3715\" srcset=\"https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-10-1200x675.jpg 1200w, https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-10-300x169.jpg 300w, https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-10-768x432.jpg 768w, https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-10.jpg 1280w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure>\n\n\n\n<p>\u97f3\u306e\u691c\u77e5\u3092\u62c5\u3063\u3066\u3044\u308b\u306e\u306f\u300c\u30b5\u30a6\u30f3\u30c9\u30bb\u30f3\u30b5\u300d\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u30b5\u30a6\u30f3\u30c9\u30bb\u30f3\u30b5\u30fc\u306b\u3064\u3044\u3066\u306f\u3001\u904e\u53bb\u8a18\u4e8b\u3067\u8a73\u3057\u304f\u89e3\u8aac\u3057\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u305d\u3061\u3089\u3092\u3054\u89a7\u4e0b\u3055\u3044\u2193<\/p>\n\n\n\n<p><a href=\"https:\/\/www.ekit-tech.com\/?p=3533\">ESP32\u3067\u7279\u5b9a\u306e\u97f3\u3092\u691c\u77e5\uff08\u30b5\u30a6\u30f3\u30c9\u30bb\u30f3\u30b5\u30fc\uff09<\/a><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\u306a\u304a\u3001\u4eca\u56de\u306f\u97f3\u306e\u7279\u5b9a\u7cbe\u5ea6\u3092\u4e0a\u3052\u308b\u305f\u3081\u306b\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u6539\u826f\u3092\u884c\u3044\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u904e\u53bb\u8a18\u4e8b\u3067\u7d39\u4ecb\u3057\u3066\u3044\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u306f\u3001\u300c\u97f3\u306e\u9577\u3055\u300d\u3060\u3051\u3067\u97f3\u306e\u898b\u6975\u3081\u3092\u884c\u3063\u3066\u3044\u307e\u3057\u305f\u304c\u3001\u3084\u306f\u308a\u8aa4\u691c\u77e5\u304c\u767a\u751f\u3057\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u305d\u3053\u3067\u3001\u300c\u97f3\u306e\u9577\u3055\u300d\u306b\u52a0\u3048\u3066\u3001\u30b5\u30a6\u30f3\u30c9\u30bb\u30f3\u30b5\u304b\u3089\u306e\u30d1\u30eb\u30b9\u304cHIGH\u306e\u3068\u304d\u306e\u7dcf\u6642\u9593\u3092\u691c\u77e5\u5bfe\u8c61\u3068\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-2.jpg\"><img loading=\"lazy\" width=\"1200\" height=\"497\" src=\"https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-2-1200x497.jpg\" alt=\"\u300c\u97f3\u306e\u9577\u3055\u300d\u3068\u300c\u30b5\u30a6\u30f3\u30c9\u30bb\u30f3\u30b5\u304b\u3089\u306e\u30d1\u30eb\u30b9\u304cHIGH\u306e\u3068\u304d\u306e\u7dcf\u6642\u9593\u300d\" class=\"wp-image-3632\" srcset=\"https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-2-1200x497.jpg 1200w, https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-2-300x124.jpg 300w, https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-2-768x318.jpg 768w, https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-2.jpg 1280w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/a><\/figure>\n\n\n\n<p>\u4eca\u306e\u3068\u3053\u308d\u3001\u8aa4\u691c\u77e5\u306f\u4e00\u56de\u3002<\/p>\n\n\n\n<p>\u306a\u305c\u304b\u3001\u5b50\u4f9b\u306e\u300c\u306f\u3041\u3041\u3041\u3041\u30fc\u30fc\u30fc\uff01\u300d\u3068\u3044\u3046\u30c9\u30e9\u30b4\u30f3\u30dc\u30fc\u30eb\u306e\u771f\u4f3c\u3092\u3057\u305f\u3068\u304d\u306e\u53eb\u3073\u58f0\u306b\u691c\u77e5\u3057\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\u305f\u3057\u304b\u306b\u97f3\u306e\u9577\u3055\u306f\u540c\u3058\u304f\u3089\u3044\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3057\u304b\u3057\u3001\u4e00\u3064\u306e\u97f3\u3067100\u4ee5\u4e0a\u306e\u30d1\u30eb\u30b9\u304c\u51fa\u3066\u3044\u308b\u306e\u3067\u3001HIGH\u306b\u306a\u3063\u305f\u7dcf\u6642\u9593\u304c\u4e00\u81f4\u3059\u308b\u306e\u306f\u3001\u304b\u306a\u308a\u4f4e\u3044\u78ba\u7387\u306a\u306e\u3067\u3059\u304c\u30fb\u30fb\u30fb<\/p>\n\n\n\n<h3><strong>LINE\u901a\u77e5<\/strong><\/h3>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-7.jpg\"><img loading=\"lazy\" width=\"1200\" height=\"675\" src=\"https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-7-1200x675.jpg\" alt=\"\u30b9\u30de\u30db\u306bLINE\u306e\u901a\u77e5\u304c\u5c4a\u3044\u305f\u69d8\u5b50\" class=\"wp-image-3712\" srcset=\"https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-7-1200x675.jpg 1200w, https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-7-300x169.jpg 300w, https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-7-768x432.jpg 768w, https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-7.jpg 1280w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/a><\/figure>\n\n\n\n<p>LINE\u901a\u77e5\u3092\u884c\u3046\u305f\u3081\u306b\u306f\u3001\u4e8b\u524d\u6e96\u5099\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u904e\u53bb\u8a18\u4e8b\u3067\u8a73\u3057\u304f\u89e3\u8aac\u3057\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u305d\u3061\u3089\u3092\u3054\u89a7\u4e0b\u3055\u3044\u2193<\/p>\n\n\n\n<p><a href=\"https:\/\/www.ekit-tech.com\/?p=3434\">\u3010ESP32\u3011\u30dc\u30bf\u30f3\u3092\u62bc\u3057\u305f\u3089LINE\u901a\u77e5<\/a><\/p>\n\n\n\n<h3><strong>LCD\u30e2\u30cb\u30bf\u306e\u5f79\u5272<\/strong><\/h3>\n\n\n\n<p>\u958b\u767a\u306f\u81ea\u5206\u306e\u90e8\u5c4b\u306e\u30d1\u30bd\u30b3\u30f3\u306e\u524d\u3067\u884c\u3044\u307e\u3057\u305f\u304c\u3001\u3053\u306e\u88c5\u7f6e\u306e\u8a2d\u7f6e\u5834\u6240\u306f\u300c\u30ad\u30c3\u30c1\u30f3\u300d\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u5834\u6240\u306b\u3088\u3063\u3066\u97f3\u306e\u53cd\u97ff\u5177\u5408\u3082\u5909\u308f\u308b\u306e\u3067\u3001\u30b5\u30a6\u30f3\u30c9\u30bb\u30f3\u30b5\u304b\u3089\u9001\u3089\u308c\u3066\u304f\u308b\u4fe1\u53f7\u3082\u5909\u308f\u3063\u3066\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\u305d\u3053\u3067\u3001\u5b9f\u969b\u306e\u8a2d\u7f6e\u5834\u6240\u3067\u3082\u300c\u97f3\u306e\u9577\u3055\u300d\u300c\u30d1\u30eb\u30b9\u304cHIGH\u306e\u7dcf\u6642\u9593\u300d\u3092\u78ba\u8a8d\u3067\u304d\u308b\u3088\u3046\u306bLCD\u30e2\u30cb\u30bf\u3092\u53d6\u4ed8\u3051\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u305d\u306e\u6570\u5024\u3092\u5143\u306b\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u66f8\u304d\u63db\u3048\u305f\u3042\u3068\u306f\u3001LCD\u30e2\u30cb\u30bf\u3092\u53d6\u308a\u5916\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1200\" height=\"675\" src=\"https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-8-1200x675.jpg\" alt=\"LCD\u30e2\u30cb\u30bf\" class=\"wp-image-3717\" srcset=\"https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-8-1200x675.jpg 1200w, https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-8-300x169.jpg 300w, https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-8-768x432.jpg 768w, https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-8.jpg 1280w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure>\n\n\n\n<p class=\"has-vivid-red-color has-text-color\">\u203b\u6587\u5b57\u5316\u3051\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u78ba\u8a8d\u7528\u3067\u304d\u308c\u3070\u554f\u984c\u306a\u3044\u306e\u3067\u4fee\u6b63\u3057\u3066\u3044\u307e\u305b\u3093\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\u3082\u3061\u308d\u3093\u3001LCD\u306f\u7121\u304f\u3066\u3082\u69cb\u3044\u307e\u305b\u3093\u3002<\/p>\n\n\n\n<p>\u30ce\u30fc\u30c8\u30d1\u30bd\u30b3\u30f3\u3092\u8fd1\u304f\u307e\u3067\u6301\u3063\u3066\u884c\u3051\u3070\u3044\u3044\u3060\u3051\u306a\u306e\u3067\u30fb\u30fb\u30fb<\/p>\n\n\n\n<h3><strong>\u30e2\u30d0\u30a4\u30eb\u30d0\u30c3\u30c6\u30ea\u30fc\u96fb\u6e90<\/strong><\/h3>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1200\" height=\"675\" src=\"https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-9-1200x675.jpg\" alt=\"\u30e2\u30d0\u30a4\u30eb\u30d0\u30c3\u30c6\u30ea\u30fc\" class=\"wp-image-3718\" srcset=\"https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-9-1200x675.jpg 1200w, https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-9-300x169.jpg 300w, https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-9-768x432.jpg 768w, https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-9.jpg 1280w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure>\n\n\n\n<p>\u4eca\u56de\u3001\u96fb\u6e90\u306b\u306f\u300c\u30e2\u30d0\u30a4\u30eb\u30d0\u30c3\u30c6\u30ea\u30fc\u300d\u3092\u4f7f\u7528\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u904e\u53bb\u8a18\u4e8b\u3067\u8a73\u3057\u304f\u89e3\u8aac\u3057\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u305d\u3061\u3089\u3092\u3054\u89a7\u4e0b\u3055\u3044\u2193<\/p>\n\n\n\n<p><a href=\"https:\/\/www.ekit-tech.com\/?p=3573\">ESP32\u3092\u30e2\u30d0\u30a4\u30eb\u30d0\u30c3\u30c6\u30ea\u30fc\u3067\u52d5\u304b\u3059\uff085V\u30d4\u30f3\u3078\u306e\u96fb\u6e90\u5165\u529b\u306b\u3064\u3044\u3066\uff09<\/a><\/p>\n\n\n\n<\/div><h2 id=\"ex\">\u4f7f\u7528\u4f8b<\/h2><div class=\"inner\">\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1200\" height=\"675\" src=\"https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-11-1200x675.jpg\" alt=\"\u30dc\u30bf\u30f3\u304c\u62bc\u3055\u308c\u305f\u3068\u304d\u306e\u300c\u30d4\u30f3\u30dd\u30fc\u30f3\u300d\u3068\u3044\u3046\u97f3\u3092\u691c\u77e5\u3057\u3066\u3001\u5bb6\u65cf\u5168\u54e1\u306bLINE\u901a\u77e5\" class=\"wp-image-3721\" srcset=\"https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-11-1200x675.jpg 1200w, https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-11-300x169.jpg 300w, https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-11-768x432.jpg 768w, https:\/\/www.ekit-tech.com\/wp-content\/uploads\/20211113-11.jpg 1280w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure>\n\n\n\n<p>\u3053\u306e\u30b7\u30b9\u30c6\u30e0\u3092\u4f5c\u3063\u305f\u76ee\u7684\u306f\u3001\u305d\u308c\u305e\u308c\u306e\u90e8\u5c4b\u306b\u3044\u308b\u5bb6\u65cf\u306b\u3054\u98ef\u304c\u3067\u304d\u305f\u3053\u3068\u3092\u77e5\u3089\u305b\u308b\u305f\u3081\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u4ed6\u306b\u3082\u3001\u30ca\u30fc\u30b9\u30b3\u30fc\u30eb\u3068\u304b\u9928\u5185\u653e\u9001\u306e\u30c1\u30e3\u30a4\u30e0\u306e\u97f3\u3068\u304b\u3001\u672c\u5143\u306e\u88c5\u7f6e\u3092\u6539\u9020\u305b\u305a\u306b\u30b7\u30b9\u30c6\u30e0\u3092\u8ffd\u52a0\u3067\u304d\u308b\u306e\u3067\u3001\u8272\u3005\u306a\u3053\u3068\u306b\u5fdc\u7528\u3067\u304d\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4eca\u56de\u306f\u3001ESP32-DevKitC\u3092\u4f7f\u3063\u305f\u300c\u7279\u5b9a\u306e\u97f3\u304c\u9cf4\u3063\u305f\u3089LINE\u3067\u901a\u77e5\u3059\u308b\u30b7\u30b9\u30c6\u30e0\u300d\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002 \u300c\u97f3\u304c\u5c4a\u304b\u306a\u3044\u3068\u3053\u308d\u306b\u3044\u308b\u4eba\u306b\u3082\u3001\u97f3\u304c\u9cf4\u3063\u305f\u3053\u3068\u3092\u77e5\u3089\u305b\u305f\u3044\u300d \u300c\u65e2\u5b58\u306e\u88c5\u7f6e\u3092\u6539\u9020\u305b\u305a\u306b\u3001LINE\u3067\u901a\u77e5\u3059\u308b\u30b7\u30b9\u30c6 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3712,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[33],"tags":[38,39,40,70],"_links":{"self":[{"href":"https:\/\/www.ekit-tech.com\/index.php?rest_route=\/wp\/v2\/posts\/3575"}],"collection":[{"href":"https:\/\/www.ekit-tech.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ekit-tech.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ekit-tech.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ekit-tech.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3575"}],"version-history":[{"count":52,"href":"https:\/\/www.ekit-tech.com\/index.php?rest_route=\/wp\/v2\/posts\/3575\/revisions"}],"predecessor-version":[{"id":7468,"href":"https:\/\/www.ekit-tech.com\/index.php?rest_route=\/wp\/v2\/posts\/3575\/revisions\/7468"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ekit-tech.com\/index.php?rest_route=\/wp\/v2\/media\/3712"}],"wp:attachment":[{"href":"https:\/\/www.ekit-tech.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3575"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ekit-tech.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3575"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ekit-tech.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3575"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}