“WiFi.begin()”的版本间的差异

来自YFRobotwiki
跳转至: 导航搜索
(以“:WiFi {| border="0" cellpadding="20" width="100%" |- |width="100%" valign="top" align="left"| <font color="olivedrab" size="+3">'''read()'''</font> ...”为内容创建页面)
 
 
(未显示1个用户的1个中间版本)
第1行: 第1行:
:[[EEPROM 库|WiFi]]
+
:[[WiFi 库|WiFi]]
  
 
{| border="0" cellpadding="20" width="100%"
 
{| border="0" cellpadding="20" width="100%"
 
|-
 
|-
 
|width="100%" valign="top" align="left"|
 
|width="100%" valign="top" align="left"|
<font color="olivedrab" size="+3">'''read()'''</font>
+
<font color="olivedrab" size="+3">'''begin()'''</font>
  
  
第10行: 第10行:
 
<font color="orange" size="+1">'''描述'''</font>
 
<font color="orange" size="+1">'''描述'''</font>
  
从EEPROM中读取一个字节。从没被写过的位置默认值为255。
+
Initializes the WiFi library's network settings and provides the current status.
  
  
 
<font color="orange" size="+1">'''语法'''</font>
 
<font color="orange" size="+1">'''语法'''</font>
  
EEPROM.read(address)
+
WiFi.begin();
 +
 
 +
WiFi.begin(ssid);
 +
 
 +
WiFi.begin(ssid, pass);
 +
 
 +
WiFi.begin(ssid, keyIndex, key);
  
  
 
<font color="orange" size="+1">'''参数'''</font>
 
<font color="orange" size="+1">'''参数'''</font>
  
address: 读取的位置,从0开始 (int 整型)
+
ssid: the SSID (Service Set Identifier) is the name of the WiFi network you want to connect to.
 +
 
 +
keyIndex: WEP encrypted networks can hold up to 4 different keys. This identifies which key you are going to use.
 +
 
 +
key: a hexadecimal string used as a security code for WEP encrypted networks.
 +
 
 +
pass: WPA encrypted networks use a password in the form of a string for security.
  
  
 
<font color="orange" size="+1">'''返回值'''</font>
 
<font color="orange" size="+1">'''返回值'''</font>
  
存储在该位置的值 (byte型)
+
-WL_CONNECTED when connected to a network
 +
 
 +
-WL_IDLE_STATUS when not connected to a network, but powered on
  
  
第31行: 第45行:
  
 
<pre style="color:dimgray">
 
<pre style="color:dimgray">
#include <EEPROM.h>
+
#include <WiFi.h>
  
int a = 0;
+
//SSID of your network
int value;
+
char ssid[] = "yourNetwork";
 +
//password of your WPA Network
 +
char pass[] = "secretPassword";
  
 
void setup()
 
void setup()
 
{
 
{
  Serial.begin(9600);
+
WiFi.begin(ssid, pass);
 
}
 
}
  
void loop()
+
void loop () {}
{
+
  value = EEPROM.read(a);
+
 
+
  Serial.print(a);
+
  Serial.print("\t");
+
  Serial.print(value);
+
  Serial.println();
+
 
+
  a = a + 1;
+
 
+
  if (a == 512)
+
    a = 0;
+
 
+
  delay(500);
+
}
+
  
 
</pre>
 
</pre>
第64行: 第65行:
 
----
 
----
  
[[EEPROM 库|返 回EEPROM 库]]
+
[[WiFi 库|返 回WiFi 库]]
  
 
[[Arduino库|返回Arduino库菜单]]
 
[[Arduino库|返回Arduino库菜单]]

2016年4月20日 (三) 08:39的最后版本

WiFi

begin()


描述

Initializes the WiFi library's network settings and provides the current status.


语法

WiFi.begin();

WiFi.begin(ssid);

WiFi.begin(ssid, pass);

WiFi.begin(ssid, keyIndex, key);


参数

ssid: the SSID (Service Set Identifier) is the name of the WiFi network you want to connect to.

keyIndex: WEP encrypted networks can hold up to 4 different keys. This identifies which key you are going to use.

key: a hexadecimal string used as a security code for WEP encrypted networks.

pass: WPA encrypted networks use a password in the form of a string for security.


返回值

-WL_CONNECTED when connected to a network

-WL_IDLE_STATUS when not connected to a network, but powered on


示例

#include <WiFi.h>

//SSID of your network 
char ssid[] = "yourNetwork";
//password of your WPA Network 
char pass[] = "secretPassword";

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

void loop () {}


返回WiFi库

返回Arduino库菜单

返回首页

更多建议和问题欢迎反馈至 YFRobot论坛