Mô-Đun Cảm Biến Khoảng Cách Hc-Sr04 Cho Arduino tại Lotte Market
Thương hiệu: | Xem thêm Linh Kiện Máy Tính Thương hiệuMô tả ngắn về Mô-Đun Cảm Biến Khoảng Cách Hc-Sr04 Cho Arduino tại Lotte Market
Ultrasonic Module mounting bracket HC-SR04 Distance Measuring Transducer Sensor for Arduino. 1: Voltage: DC 3V-5. 3: Induction Angle: not more than 15 degrees: detection range: 2cm-600cm. VCC: Connect to VCC power supply (DC 3V-5. Echo: Connect to the Echo end of the external circuit. GND: Connect to the ground of the external circuit. unsigned int EchoPin = 2;. unsigned long: Còn hàng
** Quét mã QR bằng Zalo để mua trên điện thoại
Giới thiệu Mô-Đun Cảm Biến Khoảng Cách Hc-Sr04 Cho Arduino tại Lotte Market
Ultrasonic Module mounting bracket HC-SR04 Distance Measuring Transducer Sensor for Arduinomain technical parameters:
1: Voltage: DC 3V-5.5V
2: Quiescent Current: 5.3mA
3: Induction Angle: not more than 15 degrees: detection range: 2cm-600cm
4: High precision: up to 0.1cm
VCC: Connect to VCC power supply (DC 3V-5.5V).
Trig: Connect the Trig terminal of the external circuit and input a high level above 10uS to this pin to trigger the module ranging.
Echo: Connect to the Echo end of the external circuit. When the distance measurement ends, this pin will output a high level, and the level width is the sum of the ultrasonic round trip time.
GND: Connect to the ground of the external circuit.
Appendix: New HC-SR04 High Precision Ranging Routine, (Arduino Routine)
unsigned int EchoPin = 2;
unsigned int TrigPin = 3;
unsigned long Time_Echo_us = 0;
//Len_mm_X100 = length*100
unsigned long Len_mm_X100 = 0;
unsigned long Len_Integer = 0; //
unsigned int Len_Fraction = 0;
void setup()
{
Serial.begin(9600);
pinMode(EchoPin, INPUT);
pinMode(TrigPin, OUTPUT);
}
void loop()
{
digitalWrite(TrigPin, HIGH);
delayMicroseconds(50);
digitalWrite(TrigPin, LOW);
Time_Echo_us = pulseIn(EchoPin, HIGH);
if((Time_Echo_us < 60000) && (Time_Echo_us > 1))
{
Len_mm_X100 = (Time_Echo_us*34)/2;
Len_Integer = Len_mm_X100/100;
Len_Fraction = Len_mm_X100%100;
Serial.print(”Present Length is: ”);
Serial.print(Len_Integer, DEC);
Serial.print(”.”);
if(Len_Fraction < 10)
Serial.print(”0”);
Serial.print(Len_Fraction, DEC);
Serial.println(”mm”);
}
delay(1000);
}