不過加減用吧..XD
在開發前如果你是Windows7則需要先下載驅動,比Windows7更新的系統則不用
接著下載Python和Git Bash,記得加入Path
等待Python和Git Bash安裝完成後用管理員開啟終端機輸入
cd C:\Program Files (x86)\Arduino\hardware mkdir esp8266com cd esp8266com git clone https://github.com/esp8266/Arduino.git esp8266
等待Git clone完成後輸入
cd esp8266\tools\ python.exe get.py等待下載完成重開IDE即可
Compiler時選擇WebMos D1(Retired)
baud rate選擇115200
執行結果:
Code:
/* Name: ScanWiFi.ino Created: 2017/2/22 上午 02:56:01 Author: C.Y.Fang */ #include "ESP8266WiFi.h" void setup() { Serial.begin(115200); WiFi.mode(WIFI_STA); WiFi.disconnect(); delay(100); } void loop() { int count = WiFi.scanNetworks(); if (count > 0) { for (int index = 0; index < count; index++) { Serial.print(WiFi.SSID(index)); Serial.print(" ("); Serial.print(WiFi.RSSI(index)); Serial.print(")"); delay(10); } Serial.println(""); } delay(2000); }
參考資料:
https://www.wemos.cc/tutorial/get-started-arduino.html
https://github.com/wemos/Arduino_D1/blob/master/libraries/ESP8266WiFi/examples/WiFiScan/WiFiScan.ino