ESP32 腳位34 毗連到可變電阻腳位 2
ESP32 腳位VIN 毗連到可變電阻腳位 1
ESP32 腳位GND 毗鄰到可變電阻腳位 3
ESP32若何操縱可變電阻讀取外部電壓數值 網站架設
ESP32若何操縱可變電阻讀取外部電壓數值 網站架設

讀取數值為12 bits = 4096
0 - 4095

程式碼:

  1. const int potPin = 34;
  2. int val=0;
  3. void setup() {
  4.   Serial.begin(115200); //連線速度
  5.   delay(1000);
  6. }
  7.  
  8. void loop() {
  9.   // put your main code here, to run repeatedly:
  10.   val = analogRead(potPin); //讀取電壓數值
  11.   Serial.println(val); //印出電壓數值
  12.   delay(500); //延遲0.5秒
  13. }
複製代碼



影片申明:


文章出處:網頁設計,網站架設 ,網路行銷,網頁優化,SEO -網站架設 NetYea 網頁設計

網站架設
arrow
arrow
    文章標籤
    網站架設
    全站熱搜

    juliox56aaj 發表在 痞客邦 留言(0) 人氣()