我只是不知道如何描述这个。它工作正常,但后来我改变了distance = duration*0.034/2;
. 然后我把它改回来,但它仍然给了我这些错误。是阿杜诺吗?(Bluno nano) 是密码吗?
const int trigPin = 9;
const int echoPin = 10;
int duration;
int distance;
void setup(){
Serial.begin(9600);
pinMode(echoPin, INPUT);
pinMode(trigPin, OUTPUT);
}
void loop(){
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = duration*0.034/2;
Serial.print("Distance: " + distance);
delay(500);
}