WiFi.RSSI()

描述

取得連線至路由器的訊號強度。

語法


WiFi.RSSI();
WiFi.RSSI(wifiAccessPoint);

參數

wifiAccessPoint:指明要取得訊號強度的無線網路

回傳

long:信號強度(RSSI),單位為 dBm

範例

#include <WiFi.h>

// 無線網路的 SSID
char ssid[] = "yourNetwork";
// WPA 的密碼
char pass[] = "secretPassword";

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

  if (WiFi.status() != WL_CONNECTED) {
    Serial.println("Couldn't get a wifi connection");
    while(true);
  }
  // 如果成功連上無線網路,印出相關資訊
  else {
    // 印出訊號強度
    long rssi = WiFi.RSSI();
    Serial.print("RSSI:");
    Serial.println(rssi);
  }
}

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.