【发布时间】:2014-04-07 12:39:16
【问题描述】:
此代码用于读取电位器并将值打印到 arduino 串行监视器 但即使你不移动底池,你也会得到价值。
只有在您移动电位器时,我必须在代码中进行哪些更改才能获取值?
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// print out the value you read:
Serial.println(sensorValue);
delay(1); // delay in between reads for stability
}
【问题讨论】:
-
你是不是只想在锅移动的时候写到serrial?
-
是的,我只想检查我的显示器中的值
标签: arduino