ESP32

YT

EPS-32 Getting start: https://www.youtube.com/watch?v=xPlN_Tk3VLQ

https://www.youtube.com/watch?v=AitCKcyjHuQ (ESP32 WROOM-32連接與設定)

參考文獻

ESP32 WROOM-32 參考文獻:https://bhumil-depani.medium.com/lets-program-esp-wroom-32-development-board-with-arduino-ide-50f8dd4cdd2a

Arduino IDE Preferences

https://dl.espressif.com/dl/package_esp32_index.json

ESP32 by Espressif Systems

DOIT ESP32 DEVKIT V1 或 ESP-32 Dev Module ?

a USB to UART Bridge VCP driver : https://www.silabs.com/developers/usb-to-uart-bridge-vcp-drivers ,Windows: CP210x Windows Drivers 



參考文獻:https://crazymaker.com.tw/esp32-connect-to-wifi-network/

一、安裝Arduino IDE

載點:https://www.arduino.cc/en/software 版本 2.2.1

1.選擇作業系統,通常在頁面右邊。2.點選「Just Download」。

二、安裝ESP32開發版管理員

1.開啟Arduino IDE

2.檔案(File)、喜好設定(Preferences)、其他開發版管理員網址(Additional boards manager URLs)。

輸入:https://dl.espressif.com/dl/package_esp32_index.json

或是:https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json


3.工具(Tools)、開發板(Board)、開發板管理員(Boards Manager)。

ESP32 by Espressif Systems

安裝會花一點時間。

搜尋輸入:esp32,選擇:esp32 提供者Espressif 、安裝INSTALL。

三、確認開發板

下拉選取適合的板子,例如:ESP32 Dev Module

工具(Tools)、開發板(Board)、esp32選取開發板名稱。

四、upload test

檔案(Files)、範例(Examples)、01.Basics、AnalogReadSerial

接上ESP32,按下左上角第二個符號(向右箭頭),成功上傳即可開始使用。

程式碼底下的輸出視窗最後一列出現Hard resetting via RTS pin...,即表示已經成功。

五、連接WiFi


連不上WiFi的參考方法https://youyouyou.pixnet.net/blog/post/121221280-esp32%E7%B6%B2%E8%B7%AF%E9%80%A3%E7%B7%9A%E5%95%8F%E9%A1%8C

六、程式碼

檔案名稱;sketch_esp32_wifi_dec17a.ino

sketch草稿

#include<WiFi.h>


const char ssid[]="WiFi網路名稱"; //修改為你的WiFi網路名稱

const char pwd[]="password"; //修改為你的WiFi密碼


void setup() {

// put your setup code here, to run once:

  Serial.begin(115200);


  WiFi.mode(WIFI_STA); //設置WiFi模式為用戶端連線模式

  WiFi.begin(ssid,pwd);


  Serial.print("WiFi connecting");


  //當WiFi連線時會回傳WL_CONNECTED,因此跳出迴圈時代表已成功連線

  int WifiTryCount=0;

  while(WiFi.status()!=WL_CONNECTED){

    Serial.print(".");

    delay(500);

    if (WifiTryCount++ >= 50)  {

      Serial.println("");

      ESP.restart(); //重新開機

      delay(1000);

    }

  }


  Serial.println("");

  Serial.print("IP位址:");

  Serial.println(WiFi.localIP()); //讀取IP位址

  Serial.print("WiFi RSSI:");

  Serial.println(WiFi.RSSI()); //讀取WiFi強度

 


}


void loop() {

 


}