www.keyestudio.com
Serial.print("in, ");
Serial.print(cm);
Serial.print("cm");
Serial.println();
delay(250);
}
//****************************************************************
(7) Test Result
Upload test code on the development board, open serial monitor
and set baud rate to 9600. The detected distance will be displayed,
unit is cm and inch. Hinder the ultrasonic sensor by hand, the
displayed distance value gets smaller.
(8) Code Explanation
int trigPin = 5;
this pin is defined to transmit ultrasonic waves,
106