天天看點

ARDUINO學習過程(3)電位器實驗(三)電位器實驗

(三)電位器實驗

1、連接配接圖

利用uno闆子上的A0到A5模拟輸出端口

ARDUINO學習過程(3)電位器實驗(三)電位器實驗

2、mind+

這裡是mindpuls (windows)安裝包

百度網盤連結:https://pan.baidu.com/s/1g3j0FF4E_pbuq1AF46TQyQ

提取碼:ywdt

ARDUINO學習過程(3)電位器實驗(三)電位器實驗

3、代碼

//Hello world!代碼
void setup() {
  Serial.begin(9600);
}

void loop() {
  Serial.println("hello world!");
  delay(1500);
}


#define Pot A0
int PotBuffer=0;
void setup() {
  Serial.begin(9600);
}
void loop() {
  PotBuffer=analogRead(Pot);
  Serial.print("Pot=");
  Serial.println(PotBuffer);
  delay(1500);
}

           

繼續閱讀