这个页面的 最新开发版本 可能比这个发布的 0.4.3 版本新。

station

功能概述

本例演示如何使用 Wi-Fi 的 station 功能。

环境要求

  1. 需要有一个能正常连接的AP。

  2. 在 menuconfig 中配置 WiFi SSID 和 WiFi Password。

编译和烧录

示例位置:examples/wifi/station

编译、烧录等操作请参考:快速入门

运行结果

成功运行将输出如下日志

D/main            [0.002] boot reason 0
D/main            [0.004] heap size 270848(264.50KB)
D/fls             [0.010] flash size 0x200000(2MB)
D/ptb             [0.014] partition table base 0x800e000
D/ft              [0.020] ft_0 base 8000000, ft_1 base 8001000
D/ft              [0.026] ft init too
D/ft              [0.030] ft init error
E/nvs             [0.034] use new hash entry num=53
I/ota_http        [0.040] 0.3.0 build at Jun 13 2024 10:34:10
I/wifi station    [2.296] wifi_init_sta finished.
I/wifi station    [8.688] retry to connect to the AP
I/wifi station    [8.694] connect to the AP fail
D/wifi            [8.698] distribution event 2
D/wifi            [8.702] sta disconnected reason 2
D/wifi            [9.490] distribution event 1
D/wifi            [9.494] sta connected 42-C1-82-80-2A-15 channel 6 authmode 3
I/wifi station    [10.182] got ip: 192.168.3.102
D/wifi            [10.186] distribution event 0
D/wifi            [10.192] sta got ip 192.168.3.102
I/wifi station    [10.196] connected to ap SSID:Test-WiFi password:11111111