WiFi.SSID()

從 YFRobotwiki
在2016年4月20日 (三) 09:00由Allblue對話 | 貢獻所做的修訂版本

(差異) ←上個修訂 | 最新修訂 (差異) | 下一修訂→ (差異)
跳到: 導覽搜尋
WiFi

SSID()


描述

Gets the SSID of the current network


語法

WiFi.SSID();

WiFi.SSID(wifiAccessPoint)


參數

wifiAccessPoint: specifies from which network to get the information


返回值

A string containing the SSID the WiFi shield is currently connected to.

string containing name of network requested.


示例

#include <SPI.h>
#include <WiFi.h>

//SSID of your network 
char ssid[] = "yourNetwork";
int status = WL_IDLE_STATUS;     // the Wifi radio's status

void setup()
{
  // initialize serial:
  Serial.begin(9600);

  // scan for existing networks:
  Serial.println("Scanning available networks...");
  scanNetworks();

  // attempt to connect using WEP encryption:
  Serial.println("Attempting to connect to open network...");
  status = WiFi.begin(ssid);

  Serial.print("SSID: ");
  Serial.println(ssid);

}

void loop () {}

void scanNetworks() {
  // scan for nearby networks:
  Serial.println("** Scan Networks **");
  byte numSsid = WiFi.scanNetworks();

  // print the list of networks seen:
  Serial.print("SSID List:");
  Serial.println(numSsid);
  // print the network number and name for each network found:
  for (int thisNet = 0; thisNet<numSsid; thisNet++) {
    Serial.print(thisNet);
    Serial.print(") Network: ");
    Serial.println(WiFi.SSID(thisNet));
  }
} {
}


返回WiFi庫

返回Arduino庫菜單

返回首頁

更多建議和問題歡迎反饋至 YFRobot論壇