材料準備
Ameba x 1
天線 x 1
範例說明
程式碼說明
首先使用的是顯示Ameba自己的物理地址WiFi.macAddress(mac):
https://www.arduino.cc/en/Reference/WiFiMACAddress
然後開始搜索周圍WiFi環境的WiFi.scanNetworks()
https://www.arduino.cc/en/Reference/WiFiScanNetworks
在打印WiFi具體訊息時使用到的有
顯示WiFi的名稱WiFi.SSID(thisNet):
https://www.arduino.cc/en/Reference/WiFiSSID
顯示WiFi的訊號強度WiFi.RSSI(thisNet):
https://www.arduino.cc/en/Reference/WiFiRSSI
顯示WiFi的加密方式WiFi.encryptionType(thisNet):
https://www.arduino.cc/en/Reference/WiFiEncryptionType
https://www.arduino.cc/en/Reference/WiFiMACAddress
然後開始搜索周圍WiFi環境的WiFi.scanNetworks()
https://www.arduino.cc/en/Reference/WiFiScanNetworks
在打印WiFi具體訊息時使用到的有
顯示WiFi的名稱WiFi.SSID(thisNet):
https://www.arduino.cc/en/Reference/WiFiSSID
顯示WiFi的訊號強度WiFi.RSSI(thisNet):
https://www.arduino.cc/en/Reference/WiFiRSSI
顯示WiFi的加密方式WiFi.encryptionType(thisNet):
https://www.arduino.cc/en/Reference/WiFiEncryptionType
與Arduino的差異
Arduino在完成WiFi的操作時,需要另外使用WiFi Shield來作為WiFi模塊,因此在使用WiFi是需要#include 來使用SPI與WiFi模塊進行通訊。
但是Ameba自身就具有WiFi模塊的功能,因此,不需要#include。若想要使用Arduino的範例,要先刪掉這一項。
但是Ameba自身就具有WiFi模塊的功能,因此,不需要#include
Materials
Ameba x 1
Procedure
In this example, we use Ameba to scan available WiFi hotspots in the surroundings, and prints the SSID, encryption type, signal strngth information of each detected hotspot.
First, make sure Ameba is selected in Arduino IDE: "Tools" -> "Board" -> "Arduino Ameba"
Open the "ScanNetworks" example in "File" -> "Examples" -> "AmebaWiFi" -> "ScanNetworks":
Then upload the sample code, and press the reset button on Ameba. Afterwards, you can see "**Scan Networks**" message appears, with the detected WiFi hotspots and the information of each hotspot.
First, make sure Ameba is selected in Arduino IDE: "Tools" -> "Board" -> "Arduino Ameba"
Open the "ScanNetworks" example in "File" -> "Examples" -> "AmebaWiFi" -> "ScanNetworks":
Then upload the sample code, and press the reset button on Ameba. Afterwards, you can see "**Scan Networks**" message appears, with the detected WiFi hotspots and the information of each hotspot.
Code Reference
First we use WiFi.macAddress(mac) to getthe MAC address of Ameba:
https://www.arduino.cc/en/Reference/WiFiMACAddress
Then we use WiFi.scanNetworks() to detect WiFi hotspots:
https://www.arduino.cc/en/Reference/WiFiScanNetworks
To get information of detected WiFi hotspot:
We use WiFi.SSID(thisNet) to retrieve SSID of a network:
https://www.arduino.cc/en/Reference/WiFiSSID
We use WiFi.RSSI(thisNet) to get the signal strength of the connection to the router:
https://www.arduino.cc/en/Reference/WiFiRSSI
We use WiFi.encryptionType(thisNet) to get the encryption type of the network:
https://www.arduino.cc/en/Reference/WiFiEncryptionType
https://www.arduino.cc/en/Reference/WiFiMACAddress
Then we use WiFi.scanNetworks() to detect WiFi hotspots:
https://www.arduino.cc/en/Reference/WiFiScanNetworks
To get information of detected WiFi hotspot:
We use WiFi.SSID(thisNet) to retrieve SSID of a network:
https://www.arduino.cc/en/Reference/WiFiSSID
We use WiFi.RSSI(thisNet) to get the signal strength of the connection to the router:
https://www.arduino.cc/en/Reference/WiFiRSSI
We use WiFi.encryptionType(thisNet) to get the encryption type of the network:
https://www.arduino.cc/en/Reference/WiFiEncryptionType
Comparison with Arduino
In the Arduino platform, we need to add an extra WiFi shield to be the WiFi module to realize the WiFi connection. And we have to #include to use SPI to communicate with WiFi module.
However, Ameba is already equipped with WiFi module. Therefore, #include is not needed.
However, Ameba is already equipped with WiFi module. Therefore, #include is not needed.
0 comments:
Post a Comment