40 lines
886 B
C
40 lines
886 B
C
#include <pico/stdlib.h>
|
|
#include <pico/cyw43_arch.h>
|
|
#include "PicoW_WiFi_Operator.h"
|
|
#include "PicoW_UDP.h"
|
|
|
|
int main(void)
|
|
{
|
|
stdio_init_all();
|
|
|
|
if(cyw43_arch_init_with_country(CYW43_COUNTRY_FRANCE)) return PICO_ERROR_GENERIC;
|
|
|
|
cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, true);
|
|
|
|
if(wifi_operator_init(WIFI_OPERATOR_MODE_STATION)) return PICO_ERROR_GENERIC;
|
|
|
|
while(true)
|
|
{
|
|
static uint64_t last_time = 0;
|
|
uint64_t time = time_us_64();
|
|
if(time - last_time > 1000 * 1000)
|
|
{
|
|
last_time = time;
|
|
|
|
static bool led_state = true;
|
|
led_state = !led_state;
|
|
|
|
cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, led_state);
|
|
}
|
|
|
|
cyw43_arch_poll();
|
|
|
|
tight_loop_contents();
|
|
}
|
|
|
|
if(wifi_operator_exit()) return PICO_ERROR_GENERIC;
|
|
|
|
cyw43_arch_deinit();
|
|
|
|
return PICO_OK;
|
|
} |