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.