mirror of
https://git.aixiao.me/aixiao/Danger-alarm.git
synced 2025-07-29 19:13:39 +08:00
测试WIFI TCP
This commit is contained in:
@@ -16,10 +16,14 @@
|
||||
#include "HC-12.hpp"
|
||||
#include "ZC13.hpp"
|
||||
|
||||
#ifndef PICO_DEFAULT_LED_PIN
|
||||
#warning pio/hello_pio example requires a board with a regular LED
|
||||
#define PICO_DEFAULT_LED_PIN 25
|
||||
extern "C" {
|
||||
#include "WIFI.h"
|
||||
}
|
||||
|
||||
|
||||
#ifndef PICO_DEFAULT_LED_PIN
|
||||
#warning pio/hello_pio example requires a board with a regular LED
|
||||
#define PICO_DEFAULT_LED_PIN 25
|
||||
#endif
|
||||
|
||||
static inline bool uart_rx_program_available(PIO pio, uint sm)
|
||||
@@ -254,6 +258,42 @@ static void core1_main()
|
||||
return;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
stdio_init_all();
|
||||
sleep_ms(1000);
|
||||
|
||||
if (cyw43_arch_init()) {
|
||||
DEBUG_printf("failed to initialise\n");
|
||||
return 1;
|
||||
}
|
||||
cyw43_arch_enable_sta_mode();
|
||||
|
||||
printf("Connecting to Wi-Fi...\n");
|
||||
if (cyw43_arch_wifi_connect_timeout_ms("root", "@aixiao.19960623", CYW43_AUTH_WPA2_AES_PSK, 30000)) {
|
||||
printf("failed to connect.\n");
|
||||
return 1;
|
||||
} else {
|
||||
printf("Connected.\n");
|
||||
}
|
||||
|
||||
while (1)
|
||||
{
|
||||
run_tcp_client_test();
|
||||
sleep_ms(3000);
|
||||
}
|
||||
|
||||
|
||||
|
||||
cyw43_arch_deinit();
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
stdio_init_all();
|
||||
@@ -310,14 +350,6 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
watchdog_update(); // 喂狗
|
||||
|
||||
/*
|
||||
if (1 == CH4()) {
|
||||
printf("Kitchen danger (fire) alarm detects CH4!!!\n");
|
||||
light_flashing();
|
||||
_HC_12("Kitchen danger (fire) alarm detects CH4!!!\n");
|
||||
}
|
||||
watchdog_update(); // 喂狗
|
||||
*/
|
||||
|
||||
// DS18B20
|
||||
TEMPERATURE = DS18B20();
|
||||
@@ -379,3 +411,4 @@ int main(int argc, char *argv[])
|
||||
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
Reference in New Issue
Block a user