Initial WLAN connectivity.
This commit is contained in:
parent
5a32ce8bb9
commit
95d84a69a3
1 changed files with 32 additions and 2 deletions
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue