|
@ -5,24 +5,34 @@ |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
#include <Arduino.h> |
|
|
#include <Arduino.h> |
|
|
|
|
|
#include <WiFi.h> |
|
|
|
|
|
#include <WiFiMulti.h> |
|
|
|
|
|
|
|
|
// Set LED_BUILTIN if it is not defined by Arduino framework
|
|
|
WiFiMulti wifiMulti; |
|
|
// #define LED_BUILTIN 2
|
|
|
|
|
|
|
|
|
|
|
|
void setup() |
|
|
void setup() |
|
|
{ |
|
|
{ |
|
|
|
|
|
Serial.begin(115200); |
|
|
|
|
|
|
|
|
// initialize LED digital pin as an output.
|
|
|
// initialize LED digital pin as an output.
|
|
|
pinMode(LED_BUILTIN, OUTPUT); |
|
|
pinMode(LED_BUILTIN, OUTPUT); |
|
|
|
|
|
|
|
|
|
|
|
wifiMulti.addAP(WIFI_SSID, WIFI_PASSWD); |
|
|
|
|
|
wifiMulti.addAP(WIFI_SSID2, WIFI_PASSWD2); |
|
|
|
|
|
|
|
|
|
|
|
Serial.println("Connecting Wifi..."); |
|
|
|
|
|
if(wifiMulti.run() == WL_CONNECTED) { |
|
|
|
|
|
Serial.println(""); |
|
|
|
|
|
Serial.println("WiFi connected"); |
|
|
|
|
|
Serial.println("IP address: "); |
|
|
|
|
|
Serial.println(WiFi.localIP()); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void loop() |
|
|
void loop() |
|
|
{ |
|
|
{ |
|
|
// turn the LED on (HIGH is the voltage level)
|
|
|
if(wifiMulti.run() != WL_CONNECTED) { |
|
|
digitalWrite(LED_BUILTIN, HIGH); |
|
|
Serial.println("WiFi not connected!"); |
|
|
// wait for a second
|
|
|
delay(1000); |
|
|
delay(1000); |
|
|
} |
|
|
// turn the LED off by making the voltage LOW
|
|
|
|
|
|
digitalWrite(LED_BUILTIN, LOW); |
|
|
|
|
|
// wait for a second
|
|
|
|
|
|
delay(1000); |
|
|
|
|
|
} |
|
|
} |
|
|