當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Arduino WiFi101 - WiFi.RSSI()用法及代碼示例

說明

獲取連接到路由器的信號強度

用法

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

參數

wifiAccessPoint:指定從哪個網絡獲取信息

返回

long:當前 RSSI /接收到的信號強度,以 dBm 為單位

示例

#include <SPI.h>
#include <WiFi101.h>

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

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

  if (WiFi.status() != WL_CONNECTED) {
    Serial.println("Couldn't get a wifi connection");
    while(true);
  }
  // if you are connected, print out info about the connection:
  else {
   // print the received signal strength:
  long rssi = WiFi.RSSI();
  Serial.print("RSSI:");
  Serial.println(rssi);
  }
}

void loop () {}

相關用法


注:本文由純淨天空篩選整理自arduino.cc大神的英文原創作品 WiFi101 - WiFi.RSSI()。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。