forked from esp8266/Arduino
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
2,214 additions
and
1,353 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,8 @@ | |
#define CORE_HAS_LIBB64 | ||
#define CORE_HAS_BASE64_CLASS | ||
|
||
#define WIFI_HAS_EVENT_CALLBACK | ||
|
||
|
||
#endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
libraries/ESP8266WiFi/examples/WiFiClientEvents/WiFiClientEvents.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* This sketch shows the WiFi event usage | ||
* | ||
*/ | ||
|
||
#include <ESP8266WiFi.h> | ||
|
||
const char* ssid = "your-ssid"; | ||
const char* password = "your-password"; | ||
|
||
|
||
void WiFiEvent(WiFiEvent_t event) { | ||
Serial.printf("[WiFi-event] event: %d\n", event); | ||
|
||
switch(event) { | ||
case WIFI_EVENT_STAMODE_GOT_IP: | ||
Serial.println("WiFi connected"); | ||
Serial.println("IP address: "); | ||
Serial.println(WiFi.localIP()); | ||
break; | ||
case WIFI_EVENT_STAMODE_DISCONNECTED: | ||
Serial.println("WiFi lost connection"); | ||
break; | ||
} | ||
} | ||
|
||
void setup() { | ||
Serial.begin(115200); | ||
|
||
// delete old config | ||
WiFi.disconnect(true); | ||
|
||
delay(1000); | ||
|
||
WiFi.onEvent(WiFiEvent); | ||
|
||
WiFi.begin(ssid, password); | ||
|
||
Serial.println(); | ||
Serial.println(); | ||
Serial.println("Wait for WiFi... "); | ||
} | ||
|
||
|
||
void loop() { | ||
delay(1000); | ||
} | ||
|
Oops, something went wrong.