{"id":360,"date":"2020-07-13T20:59:07","date_gmt":"2020-07-13T11:59:07","guid":{"rendered":"https:\/\/chikuwa-ringyo.com\/?p=360"},"modified":"2023-05-05T16:57:27","modified_gmt":"2023-05-05T07:57:27","slug":"x-shifter%e3%81%ae%e3%82%b9%e3%82%a4%e3%83%83%e3%83%81%e3%83%a6%e3%83%8b%e3%83%83%e3%83%88%e3%82%92%e8%87%aa%e4%bd%9c%e3%81%97%e3%81%be%e3%81%97%e3%81%9fver1-1-%e4%bd%bf%e3%81%a3%e3%81%9f%e9%83%a8","status":"publish","type":"post","link":"https:\/\/chikuwa-ringyo.com\/?p=360","title":{"rendered":"X Shifter\u306e\u30b9\u30a4\u30c3\u30c1\u30e6\u30cb\u30c3\u30c8\u3092\u81ea\u4f5c\u3057\u307e\u3057\u305fVer1.1 (\u4f7f\u3063\u305f\u90e8\u6750\u3084\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306a\u3069)"},"content":{"rendered":"<h2>\u306f\u3058\u3081\u306b<\/h2>\n<p>http:\/\/chikuwa-ringyo.com\/?p=234<br \/>\n\u3067\u901a\u4fe1\u4ed5\u69d8\u3092\u8abf\u3079\u305f\u306e\u3067\u3001\u624b\u6301\u3061\u306eArduinoNano33BLE\u3067\u30b9\u30a4\u30c3\u30c1\u30e6\u30cb\u30c3\u30c8\u3092\u81ea\u4f5c\u3057\u3066\u307f\u307e\u3057\u305f\u3002<br \/>\n\u3053\u306e\u30da\u30fc\u30b8\u3067\u306f\u4f7f\u3063\u305f\u90e8\u6750\u3084FW\u304a\u3088\u3073\u4f5c\u308b\u3046\u3048\u3067\u306e\u30e1\u30e2\u66f8\u304d\u306a\u3069\u3092\u6b8b\u3057\u3066\u304a\u3053\u3046\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-364\" src=\"https:\/\/chikuwa-ringyo.com\/wp-content\/uploads\/2020\/07\/\u53d6\u308a\u4ed8\u3051\u305a-300x225.jpg\" alt=\"\" width=\"300\" height=\"225\" \/><br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-363\" src=\"https:\/\/chikuwa-ringyo.com\/wp-content\/uploads\/2020\/07\/\u5b8c\u6210\u56f32-300x225.jpg\" alt=\"\" width=\"300\" height=\"225\" \/><\/p>\n<h2>\u6750\u6599<\/h2>\n<p>\u30fb\u30bf\u30ab\u30c1\u9632\u6c34\u30b1\u30fc\u30b9WC72-21-C[\u30de\u30eb\u30c4\u3067\u8cfc\u5165]<br \/>\n<a href=\"https:\/\/www.marutsu.co.jp\/pc\/i\/1358654\/\">\u30de\u30eb\u30c4\u30a8\u30ec\u30af\u30c8\u30ed\u30cb\u30af\u30b9<\/a><\/p>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-369\" src=\"https:\/\/chikuwa-ringyo.com\/wp-content\/uploads\/2020\/07\/\u9632\u6c34\u30b1\u30fc\u30b9-225x300.jpg\" alt=\"\" width=\"225\" height=\"300\" \/>\n<p>\u30fbarduino nano33 ble[mouser\u3067\u8cfc\u5165]<br \/>\n<!-- START MoshimoAffiliateEasyLink --><br \/>\n<script type=\"text\/javascript\">\n(function(b,c,f,g,a,d,e){b.MoshimoAffiliateObject=a;\nb[a]=b[a]||function(){arguments.currentScript=c.currentScript\n||c.scripts[c.scripts.length-2];(b[a].q=b[a].q||[]).push(arguments)};\nc.getElementById(a)||(d=c.createElement(f),d.src=g,\nd.id=a,e=c.getElementsByTagName(\"body\")[0],e.appendChild(d))})\n(window,document,\"script\",\"\/\/dn.msmstatic.com\/site\/cardlink\/bundle.js\",\"msmaflink\");\nmsmaflink({\"n\":\"Arduino Nano 33 BLE\",\"b\":\"Arduino\",\"t\":\"ABX00030\",\"d\":\"https:\\\/\\\/m.media-amazon.com\",\"c_p\":\"\\\/images\\\/I\",\"p\":[\"\\\/414VEyBARxL.jpg\",\"\\\/51dVvSXB7aL.jpg\",\"\\\/51l69uw2YEL.jpg\",\"\\\/513nnIOTqML.jpg\"],\"u\":{\"u\":\"https:\\\/\\\/www.amazon.co.jp\\\/dp\\\/B07WV59YTZ\",\"t\":\"amazon\",\"r_v\":\"\"},\"aid\":{\"amazon\":\"1778863\"},\"eid\":\"FH7Fi\",\"s\":\"s\"});\n<\/script><\/p>\n<div id=\"msmaflink-FH7Fi\">\u30ea\u30f3\u30af<\/div>\n<p><!-- MoshimoAffiliateEasyLink END --><br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-368\" src=\"https:\/\/chikuwa-ringyo.com\/wp-content\/uploads\/2020\/07\/\u30e6\u30cb\u30d0\u30fc\u30b5\u30eb\u57fa\u76e4-300x225.jpg\" alt=\"\" width=\"300\" height=\"225\" \/><\/p>\n<p>\u30fb\u30e6\u30cb\u30d0\u30fc\u30b5\u30eb\u57fa\u76e4[\u79cb\u6708\u96fb\u5b50\u3067\u8cfc\u5165](\u4f7f\u3046\u3068\u304d\u306f\u5fc5\u8981\u306a\u30b5\u30a4\u30ba\u306b\u30ab\u30c3\u30bf\u30fc\u306a\u3069\u3067\u52a0\u5de5)<br \/>\n<a href=\"http:\/\/akizukidenshi.com\/catalog\/g\/gP-03229\/\">\u5546\u54c1\u30da\u30fc\u30b8<\/a><\/p>\n<p>\u30fbL\u5b57\u30d4\u30f3\u30d8\u30c3\u30c0[\u79cb\u6708\u96fb\u5b50\u3067\u8cfc\u5165]<br \/>\n<a href=\"http:\/\/akizukidenshi.com\/catalog\/g\/gC-05336\/\">\u5546\u54c1\u30da\u30fc\u30b8<\/a><\/p>\n<p>\u30fbL\u5b57\u30d4\u30f3\u30bd\u30b1\u30c3\u30c8[\u79cb\u6708\u96fb\u5b50\u3067\u8cfc\u5165]<br \/>\n<a href=\"http:\/\/akizukidenshi.com\/catalog\/g\/gC-09862\/\">\u5546\u54c1\u30da\u30fc\u30b8<\/a><\/p>\n<p>\u30fb\u30bf\u30af\u30c8\u30b9\u30a4\u30c3\u30c1[\u79cb\u6708\u96fb\u5b50\u3067\u8cfc\u5165]<br \/>\n<a href=\"http:\/\/akizukidenshi.com\/catalog\/g\/gP-09826\/\">\u5546\u54c1\u30da\u30fc\u30b8<\/a><\/p>\n<p>\u30fb\u30b1\u30fc\u30d6\u30eb[\u8fd1\u6240\u306e\u30db\u30fc\u30e0\u30bb\u30f3\u30bf\u30fc\u3067\u8cfc\u5165\u300250\u5186\/m]<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-362\" src=\"https:\/\/chikuwa-ringyo.com\/wp-content\/uploads\/2020\/07\/\u30b1\u30fc\u30d6\u30eb-300x225.jpg\" alt=\"\" width=\"300\" height=\"225\" \/><\/p>\n<h2>\u4f4e\u6d88\u8cbb\u96fb\u529b\u5316\u3059\u308b\u305f\u3081\u306b<\/h2>\n<p>\u3053\u306e\u5185\u5bb9\u306f\u5fc5\u9808\u3067\u306f\u306a\u3044\u3067\u3059\u3002\u96fb\u6c60\u306e\u6d88\u8017\u3092\u6291\u3048\u308b\u305f\u3081\u306b\u4ee5\u4e0b\u306e\uff12\u3064\u3092\u884c\u3044\u307e\u3057\u305f\u3002<br \/>\n\u4ee5\u4e0b\u306e\u51e6\u7406\u3092\u884c\u3046\u3068FW\u306e\u66f8\u304d\u8fbc\u307f\u306a\u3069\u3067\u4e0d\u90fd\u5408\u304c\u51fa\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u306e\u3067\u304a\u6c17\u3092\u4ed8\u3051\u304f\u3060\u3055\u3044\u3002\u73fe\u5728\u306e\u6d88\u8cbb\u96fb\u6d41\u306f\u3001\u63a5\u7d9a\u5b8c\u4e86\u5f8c\u3001\u5b9a\u5e38\u72b6\u614b\u30671.3mA\u7a0b\u5ea6\u3002\u30b7\u30b9\u30c6\u30e0OFF\u664210uA\u7a0b\u5ea6\u3002<\/p>\n<h3>Arduino\u30dc\u30fc\u30c9\u306e3.3V\u30d1\u30bf\u30fc\u30f3\u30ab\u30c3\u30c8\u3092\u884c\u3046\u3002<\/h3>\n<p>\u2193\u306e\u8d64\u3067\u56f2\u3063\u305f\u7b87\u6240\u306e\u7d30\u3044\u500b\u6240\u3092\u30ab\u30c3\u30bf\u30fc\u306a\u3069\u3067\u30ab\u30c3\u30c8\u3057\u307e\u3059\u3002USB\u306e\u96fb\u6e90\u304b\u30893.3V\u30e9\u30a4\u30f3\u3078\u306e\u4f9b\u7d66\u304c\u306a\u304f\u306a\u308a\u307e\u3059\u3002\uff08USB\u304b\u3089IC\u3078\u306e\u96fb\u6e90\u4f9b\u7d66\u304c\u3067\u304d\u306a\u304f\u306a\u308a\u307e\u3059)<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-371\" src=\"https:\/\/chikuwa-ringyo.com\/wp-content\/uploads\/2020\/07\/\u30d1\u30bf\u30fc\u30f3\u30ab\u30c3\u30c8-300x255.jpg\" alt=\"\" width=\"300\" height=\"255\" \/><\/p>\n<h3>main.cpp\u306e\u30c7\u30d0\u30c3\u30b0\u30b7\u30ea\u30a2\u30eb\u901a\u4fe1\u3092\u7121\u52b9\u5316<\/h3>\n<p>arduinoNano33BLE\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u3044\u308b\u30d5\u30a9\u30eb\u30c0\u306b\u884c\u304d\u3001<br \/>\nmain.cpp\u306e40\u884c\u76ee\u306841\u884c\u76ee\u306e<br \/>\nPluggableUSBD().begin();<br \/>\nSerialUSB.begin(115200);<br \/>\n\u3092\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3059\u308b\u3002<br \/>\n\u3053\u308c\u3067Serial\u30c9\u30e9\u30a4\u30d0\u304c\u30aa\u30d5\u306b\u306a\u308b\u307f\u305f\u3044\u3067\u3059\u3002FW\u66f8\u304d\u8fbc\u307f\u306a\u3069\u3067PC\u3068\u63a5\u7d9a\u3059\u308b\u969b\u306f\u30ea\u30bb\u30c3\u30c8\u30dc\u30bf\u30f3\u3092\uff12\u56de\u62bc\u3057\u3066\u30d6\u30fc\u30c8\u30e2\u30fc\u30c9\u306b\u3057\u306a\u3044\u3068PC\u304b\u3089\u8a8d\u8b58\u3057\u306a\u304f\u306a\u308b\u306e\u3067\u6ce8\u610f\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b\u81ea\u5206\u306f\u2193\u306e\u30d5\u30a9\u30eb\u30c0\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3001<br \/>\nC:\\Users\\{\u30e6\u30fc\u30b6\u30fc\u540d}\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\mbed\\1.1.4<br \/>\n\u305d\u306e\u4e2d\u306e\\cores\\arduino\u306bmain.cpp\u304c\u3042\u308a\u307e\u3057\u305f\u3002<\/p>\n<h2>FW(\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9)<\/h2>\n<p>\u4f7f\u7528\u3059\u308b\u5834\u5408\u306f\u3001ELINK_MACADDRESS\u306b\u81ea\u5206\u306eELink\u306eMAC\u30a2\u30c9\u30ec\u30b9\u306b\u7f6e\u304d\u63db\u3048\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>FW\u306e\u52d5\u4f5c\u3068\u3057\u3066<\/p>\n<p>\u2460\u8d77\u52d5\u5f8c\u3001MAC\u30a2\u30c9\u30ec\u30b9\u3067\u30b9\u30ad\u30e3\u30f3\u3002<\/p>\n<p>\u2461\u898b\u3064\u304b\u3063\u305f\u3089\u901a\u4fe1\u78ba\u7acb(\u2462\u3078)\u3059\u308b\u3002\uff12\uff10\u79d2\u9593\u898b\u3064\u304b\u3089\u306a\u304b\u3063\u305f\u3089\u30b7\u30b9\u30c6\u30e0OFF(\u2463\u3078)\u3059\u308b\u3002<\/p>\n<p>\u2462\u901a\u4fe1\u78ba\u7acb\u5f8c\u3001\u30b9\u30a4\u30c3\u30c1\u3092\u62bc\u3059\u3068(PIN10or11\u306eLow\u30a8\u30c3\u30b8\u691c\u51fa)\u3068\u5272\u308a\u8fbc\u307f\u5185\u3067\u30d5\u30e9\u30b0\u3092\u7acb\u3066\u3001\u30e1\u30a4\u30f3\u30eb\u30fc\u30d7\u3067Elink\u3078\u306e\u5909\u901f\u6307\u793a\u3092\u9001\u4fe1\u300210\u5206\u9593\u30b9\u30a4\u30c3\u30c1\u3092\u62bc\u3055\u306a\u3044\u3068\u30b7\u30b9\u30c6\u30e0OFF(\u2463\u3078)\u3059\u308b\u3002<\/p>\n<p>\u2463\u30b7\u30b9\u30c6\u30e0OFF\u5f8c\u306f\u3001\u30b9\u30a4\u30c3\u30c1\u3092\u62bc\u3059(PIN10or11\u306eLow\u30a8\u30c3\u30b8\u691c\u51fa)\u3068\u518d\u8d77\u52d5\u3057\u3066\u2460\u3078\u3002<\/p>\n<p>\u307e\u305f\u304a\u307e\u3058\u306a\u3044\u30b3\u30fc\u30c9\u90e8\u306f\u79c1\u306e\u74b0\u5883\u3067\u306f\u52d5\u4f5c\u3057\u307e\u3057\u305f\u304c\u3001\u3059\u3079\u3066\u306eX Shifter\u3067\u5171\u901a\u304b\u306f\u691c\u8a3c\u3067\u304d\u3066\u3044\u307e\u305b\u3093\u306e\u3067\u3054\u4e86\u627f\u304f\u3060\u3055\u3044\u3002\u203b\u52d5\u3044\u305for\u52d5\u304b\u306a\u304b\u3063\u305f\u306e\u60c5\u5831\u3044\u305f\u3060\u3051\u308c\u3070\u3046\u308c\u3057\u3044\u3067\u3059\u7b11<br \/>\n2020\/07\/23 \u30b3\u30fc\u30c9\u306e\u6574\u7406\u3002\u4e0d\u8981\u306a\u30b3\u30fc\u30c9\u306e\u524a\u9664\u3084\u30b3\u30e1\u30f3\u30c8\u306e\u8ffd\u52a0<\/p>\n<pre class=\"language-cpp\"><code>#include &lt;ArduinoBLE.h&gt;\r\n\r\n\/*\u30d0\u30fc\u30b8\u30e7\u30f3*\/\r\n#define FW_VERSION \"1.3.2\"\r\n\/*\u63a5\u7d9a\u7528*\/\r\n#define ELINK_MACADDRESS \"ef:e3:c8:09:96:eb\" \/*\u4f7f\u7528\u3059\u308bElink\u306eMAC\u30a2\u30c9\u30ec\u30b9*\/\r\n#define ELINK_LOCALNAME \"Elin\" \/*\u73fe\u5728\u672a\u4f7f\u7528*\/\r\n\r\n#define PIN_SHIFT_UP    10\r\n#define PIN_SHIFT_DOWN  11\r\n\r\n#define SLEEP_ENTERTIME_SEARCH 20000 \/*ms*\/\r\n#define SLEEP_ENTERTIME 600000 \/*ms*\/\r\n\r\n\/*BLE-UUID*\/\r\n#define ELINK_SERVICE_UUID \"1523\" \/*Elink Service UUID*\/\r\n#define ELINK_CHARACTERISTIC_UUID \"1524\"  \/*Elink \u5909\u901f\u7528Characteristic UUID*\/\r\n#define ELINK_READCHARACTERISTIC_UUID \"1525\" \/*Elink\u304b\u3089\u306e\u8fd4\u4fe1\u7528Characteristic UUID*\/\r\n\r\nbool IsConnected = false;\r\nbyte sGearChangePacket[] = { 0x21, 0x00, 0x00, 0x00};\r\nvolatile bool sShiftChange = false;\r\n\r\nBLEService sElinkService;\r\nBLECharacteristic sElinkMotorCharacteristic;\r\nBLECharacteristic sElinkReadCharacteristic;\r\nBLEDevice sBLEPeripheral;\r\nunsigned long sleepTimer;\r\n\r\nbool Elink_Connect(BLEDevice peripheral) {\r\n  int failCnt = 0;\r\n  \/*\u63a5\u7d9a\u8a66\u884c*\/\r\n  while (!peripheral.connect()) {\r\n    failCnt++;\r\n    if (failCnt &gt; 2) {\r\n      return false;\r\n    }\r\n  };\r\n\r\n  \/*Discover attributes\u3092\u3057\u306a\u3044\u3068\u30b5\u30fc\u30d3\u30b9\u304c\u898b\u3048\u3066\u3053\u306a\u3044\u3002*\/\r\n  if (peripheral.discoverAttributes()) {\r\n  } else {\r\n    peripheral.disconnect();\r\n    return false;\r\n  }\r\n  \/*\u30b5\u30fc\u30d3\u30b9\u306e\u53d6\u5f97*\/\r\n  if (peripheral.discoverService(ELINK_SERVICE_UUID)) {\r\n    sElinkService = peripheral.service(ELINK_SERVICE_UUID);\r\n  } else {\r\n    peripheral.disconnect();\r\n    return false;\r\n  }\r\n  \/*Characteristic(1524)\u306e\u53d6\u5f97*\/\r\n  if (sElinkService.hasCharacteristic(ELINK_CHARACTERISTIC_UUID)) {\r\n    sElinkMotorCharacteristic = sElinkService.characteristic(ELINK_CHARACTERISTIC_UUID);\r\n  }\r\n  else {\r\n    peripheral.disconnect();\r\n    return false;\r\n  }\r\n\r\n  \/*Characteristic(1525)\u306e\u53d6\u5f97*\/\r\n  if (sElinkService.hasCharacteristic(ELINK_READCHARACTERISTIC_UUID)) {\r\n    sElinkReadCharacteristic = sElinkService.characteristic(ELINK_READCHARACTERISTIC_UUID);\r\n  }\r\n  else {\r\n    peripheral.disconnect();\r\n    return false;\r\n  }\r\n\r\n  \/*Elink\u306b\u304a\u307e\u3058\u306a\u3044\u30b3\u30fc\u30c9\u3092\u9001\u308b*\/\r\n  byte sendBytes[] = { 0xaa, 0xcf,0x00,0x00,0x5d,0x4a,0x81,0x89,0x32,0xf7,0x52,0x12,0x36,0x00,0x00,0x00,0x00,0x00};\r\n  if(sElinkMotorCharacteristic.writeValue(sendBytes, sizeof(sendBytes))){\r\n  }\r\n  return true;\r\n}\r\n\r\n\/*\r\n*\u5272\u308a\u8fbc\u307f\u5185\u3067BLE\u306ewrite\u51e6\u7406\u3092\u884c\u3046\u3068CPU\u30ea\u30bb\u30c3\u30c8\u304c\u304b\u304b\u308b\r\n*\/\r\nvoid ISR_ShiftUp() {\r\n  if(IsConnected){\r\n    sGearChangePacket<img decoding=\"async\" class=\"ranking-number\" src=\"https:\/\/chikuwa-ringyo.com\/wp-content\/themes\/jin\/img\/rank01.png\" \/> = 0x02U;\r\n    sShiftChange = true;\r\n  }\r\n}\r\nvoid ISR_ShiftDown() {\r\n  if(IsConnected){\r\n    sGearChangePacket<img decoding=\"async\" class=\"ranking-number\" src=\"https:\/\/chikuwa-ringyo.com\/wp-content\/themes\/jin\/img\/rank01.png\" \/> = 0x03U;\r\n    sShiftChange = true;\r\n  }\r\n}\r\n\r\nvoid CpuSleep(){\r\n  NRF_POWER-&gt;SYSTEMOFF = 1;\r\n}\r\n\r\nvoid timerReset(){\r\n  sleepTimer = millis();\r\n}\r\n\r\nvoid timerCheck(unsigned long tick){\r\n  unsigned long now = millis();\r\n  unsigned long divTime = now - sleepTimer;\r\n  if(divTime &gt; tick){\r\n    CpuSleep();  \r\n  }\r\n}\r\n\r\nvoid setup() {\r\n  digitalWrite(LED_PWR, LOW);\r\n\r\n  pinMode(PIN_SHIFT_UP, INPUT_PULLUP);\r\n  pinMode(PIN_SHIFT_DOWN, INPUT_PULLUP);\r\n \r\n  attachInterrupt(digitalPinToInterrupt(PIN_SHIFT_UP),ISR_ShiftUp, FALLING);\r\n  attachInterrupt(digitalPinToInterrupt(PIN_SHIFT_DOWN), ISR_ShiftDown, FALLING);\r\n\r\n  \/\/ begin initialization\r\n  if (!BLE.begin()) {\r\n    while (1);\r\n  }\r\n  BLE.setConnectionInterval(0x0006, 0x0c80);\r\n\r\n  \/\/ Elink\u3092\u30b9\u30ad\u30e3\u30f3\r\n  BLE.scanForAddress(ELINK_MACADDRESS);\r\n\r\n  timerReset();\r\n}\r\n\r\nvoid loop() {\r\n\r\n  if (IsConnected == true ) {\r\n    \/*\u63a5\u7d9a\u4e2d*\/\r\n    delay(100);\r\n    if(!sBLEPeripheral.connected()){\r\n      \/*\u901a\u4fe1\u5207\u65ad\u3055\u308c\u3066\u3044\u305f\u5834\u5408\u3001\u518d\u63a5\u7d9a\u51e6\u7406*\/\r\n      ELINK_DisConnect();\r\n      return;\r\n    }\r\n    if(sShiftChange == true){\r\n      timerReset();\r\n      sShiftChange = false;\r\n      while(!sElinkMotorCharacteristic.writeValue(sGearChangePacket, sizeof(sGearChangePacket))){\r\n      }\r\n    }\r\n    timerCheck(SLEEP_ENTERTIME);\r\n  } else {\r\n    \/*\u30b9\u30ad\u30e3\u30f3\u4e2d*\/\r\n    ELINK_DuringScan();\r\n    timerCheck(SLEEP_ENTERTIME_SEARCH);\r\n  }\r\n}\r\n\r\nvoid ELINK_DuringScan() {\r\n  BLEDevice peripheral = BLE.available();\r\n  if (peripheral) {\r\n    BLE.stopScan();\/*\u30b9\u30ad\u30e3\u30f3\u3092\u30b9\u30c8\u30c3\u30d7\u3057\u3066\u304b\u3089Connect\u3057\u306a\u3044\u3068Connect\u306b\u9ad8\u78ba\u7387\u3067\u5931\u6557\u3059\u308b*\/\r\n    if (!Elink_Connect(peripheral)) {\r\n      \/*\u63a5\u7d9a\u306b\u5931\u6557\u3057\u305f\u3089\u518d\u30b9\u30ad\u30e3\u30f3*\/\r\n      BLE.scanForAddress(ELINK_MACADDRESS);\r\n    } else {\r\n      \/*\u63a5\u7d9a\u5b8c\u4e86*\/\r\n      IsConnected = true;\r\n      sBLEPeripheral = peripheral;\r\n      timerReset();\r\n    }\r\n  }\r\n}\r\n\r\nvoid ELINK_DisConnect() {\r\n  IsConnected = false;\r\n  BLE.scanForAddress(ELINK_MACADDRESS);\r\n  timerReset();\r\n}<\/code><\/pre>\n<h2>\u56de\u8def\u56f3<\/h2>\n<p>\u56de\u8def\u56f3\u3068\u3044\u3046\u307b\u3069\u5927\u3057\u305f\u3082\u306e\u3067\u306f\u306a\u3044\u3067\u3059\u304c\u3001\u3001\u3001<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-370\" src=\"https:\/\/chikuwa-ringyo.com\/wp-content\/uploads\/2020\/07\/\u56de\u8def\u56f3-300x237.png\" alt=\"\" width=\"300\" height=\"237\" \/><\/p>\n<h2>\u5b8c\u6210\u3057\u305f\u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u5916\u89b3\u56f3<\/h2>\n<p>\u3054\u53c2\u8003\u307e\u3067\u306b\u3002\u3002\u3002<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-367\" src=\"https:\/\/chikuwa-ringyo.com\/wp-content\/uploads\/2020\/07\/\u30e2\u30b8\u30e5\u30fc\u30eb\u5916\u89b3-225x300.jpg\" alt=\"\" width=\"225\" height=\"300\" \/><br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-366\" src=\"https:\/\/chikuwa-ringyo.com\/wp-content\/uploads\/2020\/07\/\u57fa\u76e4\u88cf\u9762-225x300.jpg\" alt=\"\" width=\"225\" height=\"300\" \/><br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-361\" src=\"https:\/\/chikuwa-ringyo.com\/wp-content\/uploads\/2020\/07\/\u5b8c\u6210\u56f3-300x225.jpg\" alt=\"\" width=\"300\" height=\"225\" \/><\/p>\n<h2>\u53c2\u8003\u306b\u3055\u305b\u3066\u3044\u305f\u3060\u3044\u305f\u30b5\u30a4\u30c8<\/h2>\n<p><a href=\"https:\/\/www.arduino.cc\/en\/Reference\/ArduinoBLE\" target=\"_blank\" rel=\"noopener noreferrer\">ArduionoBLE\u30e9\u30a4\u30d6\u30e9\u30ea\u3000\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9<\/a><br \/>\n<a href=\"https:\/\/qiita.com\/konikoni428\/items\/f4c7154ccf1eafd331c9\" target=\"_blank\" rel=\"noopener noreferrer\">Arduino NANO 33 BLE\u3092ArduinoIDE\u3067\u4f7f\u3048\u308b\u3088\u3046\u306b\u3059\u308b\u65b9\u6cd5<\/a><br \/>\n<a href=\"https:\/\/forum.arduino.cc\/index.php?topic=665272.0\" target=\"_blank\" rel=\"noopener noreferrer\">Arduino Nano33 BLE\u306e\u4f4e\u6d88\u8cbb\u96fb\u529b\u5316\u306b\u3064\u3044\u3066(\u82f1\u8a9e\u306eArduinoFourum\u30fb)<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u306f\u3058\u3081\u306b http:\/\/chikuwa-ringyo.com\/?p=234 \u3067\u901a\u4fe1\u4ed5\u69d8\u3092\u8abf\u3079\u305f\u306e\u3067\u3001\u624b\u6301\u3061\u306eArduinoNano33BLE\u3067\u30b9\u30a4\u30c3\u30c1\u30e6\u30cb\u30c3\u30c8\u3092\u81ea\u4f5c\u3057\u3066\u307f\u307e\u3057\u305f\u3002 \u3053\u306e\u30da\u30fc\u30b8\u3067\u306f\u4f7f\u3063\u305f\u90e8\u6750\u3084FW\u304a\u3088\u3073\u4f5c\u308b<\/p>\n","protected":false},"author":1,"featured_media":361,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[27],"tags":[11,23,24,8,9],"_links":{"self":[{"href":"https:\/\/chikuwa-ringyo.com\/index.php?rest_route=\/wp\/v2\/posts\/360"}],"collection":[{"href":"https:\/\/chikuwa-ringyo.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chikuwa-ringyo.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chikuwa-ringyo.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/chikuwa-ringyo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=360"}],"version-history":[{"count":12,"href":"https:\/\/chikuwa-ringyo.com\/index.php?rest_route=\/wp\/v2\/posts\/360\/revisions"}],"predecessor-version":[{"id":386,"href":"https:\/\/chikuwa-ringyo.com\/index.php?rest_route=\/wp\/v2\/posts\/360\/revisions\/386"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/chikuwa-ringyo.com\/index.php?rest_route=\/wp\/v2\/media\/361"}],"wp:attachment":[{"href":"https:\/\/chikuwa-ringyo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=360"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chikuwa-ringyo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=360"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chikuwa-ringyo.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=360"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}