mirror of
				https://github.com/esp8266/Arduino.git
				synced 2025-10-31 15:50:55 +03:00 
			
		
		
		
	* update examples * fix serial<->tcp example, use STASSID instead of SSID (name collision) * fix HTTPSRequest.ino * update AxTLS HTTPS examples, update AxTLS API to deprecated * fixes * fixes + fix astyle (no preproc directives) + restyling script * fix HTTPClient library * fixes * common.sh: do not reload arduino when already present (for locally CI testing) * common.sh: do not reload ArduinoJson when already present (for locally CI testing) * fix * fix * fix deprecated example * fix WiFiHTTPSServer.ino * reduce footprint * wipfix * fix led builtin * fix example * finished updating APSSID on all examples * style * restyle examples * helper to run CI test locally * local CI runner more verbose * +const * deprecation deprecation * deprecation * Update NTPClient.ino const char[] => const char * * Update interactive.ino const char[] => const char *
		
			
				
	
	
		
			47 lines
		
	
	
		
			1015 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			47 lines
		
	
	
		
			1015 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #include <ESP8266WiFi.h>
 | |
| #include <ESP8266mDNS.h>
 | |
| #include <ArduinoOTA.h>
 | |
| #include <ESP8266WebServer.h>
 | |
| 
 | |
| #ifndef STASSID
 | |
| #define STASSID "your-ssid"
 | |
| #define STAPSK  "your-password"
 | |
| #endif
 | |
| 
 | |
| const char* ssid = STASSID;
 | |
| const char* password = STAPSK;
 | |
| 
 | |
| ESP8266WebServer server(80);
 | |
| 
 | |
| const char* www_username = "admin";
 | |
| const char* www_password = "esp8266";
 | |
| 
 | |
| void setup() {
 | |
|   Serial.begin(115200);
 | |
|   WiFi.mode(WIFI_STA);
 | |
|   WiFi.begin(ssid, password);
 | |
|   if (WiFi.waitForConnectResult() != WL_CONNECTED) {
 | |
|     Serial.println("WiFi Connect Failed! Rebooting...");
 | |
|     delay(1000);
 | |
|     ESP.restart();
 | |
|   }
 | |
|   ArduinoOTA.begin();
 | |
| 
 | |
|   server.on("/", []() {
 | |
|     if (!server.authenticate(www_username, www_password)) {
 | |
|       return server.requestAuthentication();
 | |
|     }
 | |
|     server.send(200, "text/plain", "Login OK");
 | |
|   });
 | |
|   server.begin();
 | |
| 
 | |
|   Serial.print("Open http://");
 | |
|   Serial.print(WiFi.localIP());
 | |
|   Serial.println("/ in your browser to see it working");
 | |
| }
 | |
| 
 | |
| void loop() {
 | |
|   ArduinoOTA.handle();
 | |
|   server.handleClient();
 | |
| }
 |