WiFi.begin()

描述

初始化 WiFi 函式库并回传目前的网路状态。

语法


WiFi.begin();
WiFi.begin(ssid);
WiFi.begin(ssid, pass);
WiFi.begin(ssid, keyIndex, key);

参数

ssid:欲连线的无线网路的 SSID
keyIndex:使用 WEP 加密的无线网路可以储存 4 组不同的钥匙,keyIndex 用来指示要使用的钥匙
key:连线到 WEP 加密的无线网路时使用的钥匙
pass:连线到 WPA 加密的无线网路时使用的密码

回传

WL_CONNECTED:连线至网路
WL_IDLE_STATUS:没有连线至网路,处于待命状态

范例

#include <WiFi.h>

//无线网路的 SSID
char ssid[] = "yourNetwork";
//WPA 的密码
char pass[] = "secretPassword";

void setup()
{
  WiFi.begin(ssid, pass);
}

void loop () {}

函式库参考主页面

The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.