tcp test
This commit is contained in:
34
src/main.c
34
src/main.c
@@ -1,24 +1,26 @@
|
||||
#include <stdio.h>
|
||||
#include "pico/stdlib.h"
|
||||
#include "pico/cyw43_arch.h"
|
||||
#include <stdbool.h>
|
||||
#include <net/net.h>
|
||||
|
||||
int main(void) {
|
||||
stdio_init_all();
|
||||
|
||||
// Initialise the Wi-Fi chip
|
||||
if (cyw43_arch_init()) {
|
||||
printf("Wi-Fi init failed\n");
|
||||
return -1;
|
||||
net_creds_t creds = {
|
||||
.ssid = "5",
|
||||
.password = "nevem123"
|
||||
};
|
||||
|
||||
net_server_t* server = Net_Init(&creds);
|
||||
if (!server) {
|
||||
printf("Failed to initialize network\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Example to turn on the Pico W LED
|
||||
bool led_on = true;
|
||||
if (!Net_Listen(server)) {
|
||||
printf("Failed to start server\n");
|
||||
Net_Destroy(server);
|
||||
return 1;
|
||||
}
|
||||
|
||||
Net_Destroy(server);
|
||||
|
||||
|
||||
while (true) {
|
||||
cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, led_on);
|
||||
led_on = !led_on; // Toggle LED state
|
||||
sleep_ms(1000);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user