第02週- IoT 第一個 LED 電路、程式
簡介課本、零件教材內容
依個人 NB 安裝 Arduino IDE 版本、設定 ESP32
下載 Arduino IDE 2.0.4 版本:
前往 https://www.arduino.cc/en/software
-
點選所需版本
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
-
選擇 just download
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
安裝 Arduino IDE 2.0.4 版本:
-
Windows 版本
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
-
Mac 版本
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
Arduino IDE 2.0.4 版本的環境:
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
Arduino 2.0.4 版本的ESP32環境設定 :
- 先動 Perferences:
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
- 再點選 Additional boards manager URLs:
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
- 選擇 "Click for a list of unofficial support URLs"
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
- 到 github 挑選 "Espressif ESP32:"
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
- 點選 "OK"
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
Arduino IDE 2.0.4 選擇開發板:
- 選 "boards manager"
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
- key-in "esp32"
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
- 選 "esp32 by Espressif systems" 和 "install"
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
- 選 "Select other board and port…"
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
- 選 "SEP32 Wrover Module"
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
Arduino IDE 所需之 USB 驅動程式
前往網頁下載對應的 windows 或 Mac driver:
- 參考網頁: https://www.wch.cn/download/CH341SER_EXE.html
- 安裝完成後,選擇正確的 port:
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
第一個麵包板電路、程式
認識麵包板
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
安裝 ESP32 並貼上腳位標籤
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
依 +、- 腳位,正確放置 LED
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
再放置 220 歐姆 電阻
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
決定電阻值:
1)LED 耐電壓約 2V
2)LED 所需電流約 20 mA = 0.02 A
R = V / I = (3.3 – 2) / 0.02 = 65 ohm (至少)
–> 因此 220 ohm 是OK的。
接地線、3.3V電源
是否 LED 亮起?
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
去除 3.3V電源,連 GPIO2
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
點亮第一顆 LED
執行第一支程式
-
選 Blink
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
-
接上 USB 線,押選 "Upload"
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
-
Upload 發生錯誤
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
-
修改程式內容
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
-
上傳成功!是否閃耀第一顆LED電路?
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
Arduino 程式基礎
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
1. 語法
一種「類C語言」,很多觀念跟 “C語言” 相同 (編譯式,非直譯式)
2. 架構、函式
內定一定要包含有二個函式,不然程式編譯時,會產生錯誤:
setup():第一個執行的函式,而且只會執行一次
loop() :第二個執行的函式,而且會一直重覆執行
3. 資料型態
int:用來宣告變數為整數
void : 用於宣告函式,不回傳任何數值
4. 指令
pinMode(gpio #, mode)
digitalWrite(gpio #, state)
SP32 GPIO 腳位
- 全部腳位圖
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
- SPI 記憶體專用,不可當輸出入
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
- 無內電阻,僅可輸入,不可當輸出
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
- I2C 專用
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
- 兩組 ADC,第二組會和BLE或wifi相衝突

電路設計基礎
你需具備的電路基礎觀念 (What you need to know before starting your first Electrical circuit):
-
直流電源 (DC Power source)

-
封閉環 (Close loop)

-
接地 (Grounding)

-
數位訊號輸入接地(digital read grounding)

-
感測器接地線 (Sensor grounding):
Normal LOW, Resistive Sensors

Normal HIGH, Voltage-controlling Sensors

挑戰題:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
延伸整合題
設計街口交通燈號
紅、黃、綠 依序啟閉
紅 LED 亮兩秒半後關閉,同時亮綠 LED
綠 LED 亮兩秒後關閉,同時亮黃 LED
黃 LED 亮半秒後關閉,同時亮紅 LED
提示 (hint):
選擇正確的 ADC(2) 腳位,分別接不同 LED
delay(1000) 代表延遲一千亳秒 = 一秒
免費線上模擬器介紹
- TinkerCAD 電路設計:
- 模擬 Arduino 各種開板、各項電子零件和電路 (circuits)
- 建立帳戶 (Account creation)
- 開始第一專案 (Start your first project)
- 交換學習專案 (Exchanging your projects)
- WOKWI 模擬器:
- 免費的線上Arduino, ESP32 和 Raspberry Pi Pico 開發板模擬器
- 建立帳戶 (Account creation)

參考資料
1)IOT物聯網應用第七章 – 尤濬哲(夜市小霸王) 編著