|  |  | @ -8,8 +8,8 @@ | 
			
		
	
		
		
			
				
					
					|  |  |  | #include "esp_log.h" |  |  |  | #include "esp_log.h" | 
			
		
	
		
		
			
				
					
					|  |  |  | #include "nvs_flash.h" |  |  |  | #include "nvs_flash.h" | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | #define WIFI_SSID "MYSSID" |  |  |  | #define WIFI_SSID "AndroidAP" | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | #define WIFI_PASS "MYPASSWORD" |  |  |  | #define WIFI_PASS "uyts6533" | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | // Event group
 |  |  |  | // Event group
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -99,5 +99,30 @@ void app_main() | 
			
		
	
		
		
			
				
					
					|  |  |  | 	printf("Connecting to %s\n", WIFI_SSID); |  |  |  | 	printf("Connecting to %s\n", WIFI_SSID); | 
			
		
	
		
		
			
				
					
					|  |  |  | 	 |  |  |  | 	 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	// start the main task
 |  |  |  | 	// start the main task
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     xTaskCreate(&main_task, "main_task", 2048, NULL, 5, NULL); |  |  |  |     //xTaskCreate(&main_task, "main_task", 2048, NULL, 5, NULL);
 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     EventBits_t uxBits; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	uxBits = xEventGroupWaitBits(wifi_event_group, CONNECTED_BIT, false, true, 5000 / portTICK_PERIOD_MS); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     if( ( uxBits & CONNECTED_BIT ) != 0 ) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         printf("Connected!\n"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     else{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         printf("Not connected!\n"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         ESP_ERROR_CHECK(esp_wifi_stop()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         esp_wifi_set_mode(WIFI_MODE_AP); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         wifi_config_t ap_config = { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             .ap = { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 .ssid = "lamp", | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 .channel = 0, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 .authmode = WIFI_AUTH_OPEN, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 .ssid_hidden = 0, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 .max_connection = 1, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 .beacon_interval = 100 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         }; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         esp_wifi_set_config(WIFI_IF_AP, &ap_config); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         ESP_ERROR_CHECK(esp_wifi_start()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
	
		
		
			
				
					|  |  | 
 |