mirror of
				https://github.com/esp8266/Arduino.git
				synced 2025-10-30 04:26:50 +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 *
		
			
				
	
	
		
			59 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			59 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| #include <ESP8266WiFi.h>
 | |
| #include <ESP8266WebServer.h>
 | |
| #include <ESP8266SSDP.h>
 | |
| 
 | |
| #ifndef STASSID
 | |
| #define STASSID "your-ssid"
 | |
| #define STAPSK  "your-password"
 | |
| #endif
 | |
| 
 | |
| const char* ssid = STASSID;
 | |
| const char* password = STAPSK;
 | |
| 
 | |
| ESP8266WebServer HTTP(80);
 | |
| 
 | |
| void setup() {
 | |
|   Serial.begin(115200);
 | |
|   Serial.println();
 | |
|   Serial.println("Starting WiFi...");
 | |
| 
 | |
|   WiFi.mode(WIFI_STA);
 | |
|   WiFi.begin(ssid, password);
 | |
|   if (WiFi.waitForConnectResult() == WL_CONNECTED) {
 | |
| 
 | |
|     Serial.printf("Starting HTTP...\n");
 | |
|     HTTP.on("/index.html", HTTP_GET, []() {
 | |
|       HTTP.send(200, "text/plain", "Hello World!");
 | |
|     });
 | |
|     HTTP.on("/description.xml", HTTP_GET, []() {
 | |
|       SSDP.schema(HTTP.client());
 | |
|     });
 | |
|     HTTP.begin();
 | |
| 
 | |
|     Serial.printf("Starting SSDP...\n");
 | |
|     SSDP.setSchemaURL("description.xml");
 | |
|     SSDP.setHTTPPort(80);
 | |
|     SSDP.setName("Philips hue clone");
 | |
|     SSDP.setSerialNumber("001788102201");
 | |
|     SSDP.setURL("index.html");
 | |
|     SSDP.setModelName("Philips hue bridge 2012");
 | |
|     SSDP.setModelNumber("929000226503");
 | |
|     SSDP.setModelURL("http://www.meethue.com");
 | |
|     SSDP.setManufacturer("Royal Philips Electronics");
 | |
|     SSDP.setManufacturerURL("http://www.philips.com");
 | |
|     SSDP.begin();
 | |
| 
 | |
|     Serial.printf("Ready!\n");
 | |
|   } else {
 | |
|     Serial.printf("WiFi Failed\n");
 | |
|     while (1) {
 | |
|       delay(100);
 | |
|     }
 | |
|   }
 | |
| }
 | |
| 
 | |
| void loop() {
 | |
|   HTTP.handleClient();
 | |
|   delay(1);
 | |
| }
 |