-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathmain.c
More file actions
38 lines (30 loc) · 940 Bytes
/
main.c
File metadata and controls
38 lines (30 loc) · 940 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "lwip/apps/httpd.h"
#include "pico/stdlib.h"
#include "pico/cyw43_arch.h"
#include "lwipopts.h"
#include "ssi.h"
#include "cgi.h"
// WIFI Credentials - take care if pushing to github!
const char WIFI_SSID[] = "XXX";
const char WIFI_PASSWORD[] = "XXX";
int main() {
stdio_init_all();
cyw43_arch_init();
cyw43_arch_enable_sta_mode();
// Connect to the WiFI network - loop until connected
while(cyw43_arch_wifi_connect_timeout_ms(WIFI_SSID, WIFI_PASSWORD, CYW43_AUTH_WPA2_AES_PSK, 30000) != 0){
printf("Attempting to connect...\n");
}
// Print a success message once connected
printf("Connected! \n");
// Initialise web server
httpd_init();
printf("Http server initialised\n");
// Configure SSI and CGI handler
ssi_init();
printf("SSI Handler initialised\n");
cgi_init();
printf("CGI Handler initialised\n");
// Infinite loop
while(1);
}