113寒假_科技小創客-互動科技裝置設計(四)_I


範例程式

const int resistorPin = 12;  // 連接電阻的腳位

const int groundPin = A0;    // 連接導線的腳位

void setup() {

  Serial.begin(9600);  // 初始化序列通訊

}

void loop() {

  int sensorValue = analogRead(resistorPin);  // 讀取電壓值

  Serial.println(sensorValue);  // 將值輸出到序列監視器

  delay(100);  // 延遲以減少讀取速率

}


0 條回復   |  直到 2月前 | 114 次瀏覽




熱門評論


登入後才可發表內容