Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
ankayca authored Aug 18, 2020
1 parent 1ac870e commit 68c468b
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions main/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
An example showing the ESP32 as a
WebSocket server.
Demonstrates:
the ESP32 as a WiFi Access Point,
embedding files (html, js, etc.) for a server,
WebSockets,
LED control.
All example options are in "Example Options"
All WebSocket Server options are in:
Component config ---> WebSocket Server
Connect an LED to pin 2 (default)
Connect to the Access Point,
default name: "ESP32 Test"
password: "hello world"
go to 192.168.4.1 in a browser
Note that there are two regular server tasks.
The first gets incoming clients, then passes them
to a queue for the second task to actually handle.
I found that connections were dropped much less frequently
this way, especially when handling large requests. It
does use more RAM though.
*/

#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/queue.h"

#include "lwip/api.h"

#include "esp_wifi.h"
#include "esp_log.h"
#include "esp_event.h"
#include "nvs_flash.h"
#include "driver/ledc.h"

#include "string.h"

#include "websocket_server.h"

#include "server.h"






void app_main() {


tcpip_adapter_init();
nvs_flash_init();
wifi_setup();

ws_server_start();
xTaskCreate(&server_task,"server_task",3000,NULL,9,NULL);
xTaskCreate(&server_handle_task,"server_handle_task",4000,NULL,6,NULL);

}

0 comments on commit 68c468b

Please sign in to comment.