diff --git a/src/abfall.cpp b/src/abfall.cpp index 92b48d2..63c466c 100644 --- a/src/abfall.cpp +++ b/src/abfall.cpp @@ -2,11 +2,41 @@ #include "pico/stdlib.h" #include "pico/cyw43_arch.h" +#define WIFI_SSID "Apis cerana" +#define WIFI_PASSWORD "2JkJEh2vptVT" + +bool wifi_connect() +{ + cyw43_arch_enable_sta_mode(); + + printf("Connecting to WiFi...\n"); + if (cyw43_arch_wifi_connect_timeout_ms(WIFI_SSID, WIFI_PASSWORD, CYW43_AUTH_WPA2_AES_PSK, 30000)) + { + printf("Failed to connect.\n"); + return false; + } + else + { + printf("Connected.\n"); + } + + return true; +} + int main() { stdio_init_all(); - puts("Hello, world!"); + if (cyw43_arch_init()) + { + printf("Failed to initialize\n"); + return 1; + } - return 0; + if (wifi_connect() == false) + { + return 1; + } + + cyw43_arch_deinit(); }