c92b617397
If you develop on windows and need cr/lf files, see this: https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#_formatting_and_whitespace Git can handle this by auto-converting CRLF line endings into LF when you add a file to the index, and vice versa when it checks out code onto your filesystem. You can turn on this functionality with the core.autocrlf setting. If you're on a Windows machine, set it to true - this converts LF endings into CRLF when you check out code: $ git config --global core.autocrlf true
52 lines
844 B
C++
52 lines
844 B
C++
/*
|
|
* This sketch shows the WiFi event usage
|
|
*
|
|
*/
|
|
|
|
#include <WiFi.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 SYSTEM_EVENT_STA_GOT_IP:
|
|
Serial.println("WiFi connected");
|
|
Serial.println("IP address: ");
|
|
Serial.println(WiFi.localIP());
|
|
break;
|
|
case SYSTEM_EVENT_STA_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);
|
|
}
|
|
|