掲載日:2017.11.11
LINE Notify への送信
boolean connectWiFiMulti() { int n; int count = 0; int retry = 0; DBG_PRINTLN("WiFi Multi connecting..."); // 使えるアクセスポイントに繋ぐ wifiMulti.addAP("SSID1", "password"); wifiMulti.addAP("SSID2", "password"); // WiFi接続 while ((n = wifiMulti.run()) != WL_CONNECTED) { switch (n) { case WL_NO_SHIELD: DBG_PRINTLN(" stat:NO SHIELD"); break; case WL_IDLE_STATUS: DBG_PRINTLN(" stat:IDLE STATUS"); break; case WL_NO_SSID_AVAIL: DBG_PRINTLN(" stat:NO SSID AVAIL"); break; case WL_SCAN_COMPLETED: DBG_PRINTLN(" stat:SCAN COMPLETED"); break; case WL_CONNECTED: DBG_PRINTLN(" stat:CONNECTED"); break; case WL_CONNECT_FAILED: DBG_PRINTLN(" stat:CONNECT FAILED"); break; case WL_CONNECTION_LOST: DBG_PRINTLN(" stat:CONNECTION LOST"); break; case WL_DISCONNECTED: DBG_PRINTLN(" stat:DISCONNECTED"); break; } delay(500); if (count++ > 60) { // タイムアウト処理 DBG_PRINTLN(" time out"); DBG_PRINTLN(); return false; } } DBG_PRINTLN(); DBG_PRINTLN("WiFi connected"); DBG_PRINT(" SSID:"); DBG_PRINTLN(WiFi.SSID()); DBG_PRINT(" IP:"); DBG_PRINTLN(WiFi.localIP()); DBG_PRINTLN(); DBG_PRINTLN("-- WiFi Diag --"); WiFi.printDiag(Serial); DBG_PRINTLN(); // NTP 時刻合わせ adjustNTPTime(); return true; }