说明
返回连接状态。
用法
client.status()
参数
- None
返回
- 客户端连接状态
示例
…
void setup() {
Serial.begin(9600);
while (!Serial) {
; }
if (WiFi.status() == WL_NO_MODULE) {
Serial.println("Communication with WiFi module failed!");
while (true);
}
while (status != WL_CONNECTED) {
Serial.print("Attempting to connect to SSID: ");
Serial.println(ssid);
status = WiFi.begin(ssid, pass);
delay(10000);
}
Serial.println("Connected to wifi");
printWifiStatus();
Serial.println("\nStarting connection to server...");
IPAddress result;
int err = WiFi.hostByName(server, result) ;
if (err == 1) {
Serial.print("Ip address: ");
Serial.println(result);
} else {
Serial.print("Error code: ");
Serial.println(err);
}
if (client.connect(result, 80)) {
Serial.println("connected to server");
client.println("GET /search?q=arduino HTTP/1.1");
client.println("Host: www.google.com");
client.println("Connection: close");
client.println();
}
Serial.print("status: ");
Serial.println(client.status());
}
…
相关用法
- Arduino WiFiNINA - client.connected()用法及代码示例
- Arduino WiFiNINA - client.connectSSL()用法及代码示例
- Arduino WiFiNINA - client.connect()用法及代码示例
- Arduino WiFiNINA - client.available()用法及代码示例
- Arduino WiFiNINA - client.peek()用法及代码示例
- Arduino WiFiNINA - WiFi.config()用法及代码示例
- Arduino WiFiNINA - server.status()用法及代码示例
- Arduino WiFiNINA - WiFi.encryptionType()用法及代码示例
- Arduino WiFiNINA - WiFi.gatewayIP()用法及代码示例
- Arduino WiFiNINA - WiFi.BSSID()用法及代码示例
- Arduino WiFiNINA - WiFi.begin()用法及代码示例
- Arduino WiFiNINA - WiFi.RSSI()用法及代码示例
- Arduino WiFiNINA - WiFi.channel()用法及代码示例
- Arduino WiFiNINA - WiFi.setTimeout()用法及代码示例
- Arduino WiFiNINA - WiFi.scanNetworks()用法及代码示例
- Arduino WiFiNINA - WiFiSSLClient用法及代码示例
- Arduino WiFiNINA - server.peek()用法及代码示例
- Arduino WiFiNINA - server.available()用法及代码示例
- Arduino WiFiNINA - WiFi.localIP()用法及代码示例
- Arduino WiFiNINA - WiFi.beginAP()用法及代码示例
- Arduino WiFiNINA - WiFi.setHostname()用法及代码示例
- Arduino WiFiNINA - server.write()用法及代码示例
- Arduino WiFiNINA - server.begin()用法及代码示例
- Arduino WiFiNINA - WiFi.hostByName()用法及代码示例
- Arduino WiFiNINA - WiFi.firmwareVersion()用法及代码示例
注:本文由纯净天空筛选整理自arduino.cc大神的英文原创作品 WiFiNINA - client.status()。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。