RCW-0006 초음파 거리센서 + 고정판 구입하기 >>

RCW-0006 초음파 거리센서(Ultrasonic Distance Sensor)는
동작전압이 3V~5.5V 까지 가능하여 아두이노(Arduino) 뿐만 아니라
ESP8266 3.3V에서도 동작이 가능하여 HC-SR04 모듈을 확장합니다.

고정판(Mounting Bracket)은 RCW-0006 초음파 거리센서를
고정시킬 수 있는 2개의 구멍이 있습니다.

ultrasonic-distance-sensor2

Wide working voltage: 3~5.5V; Compatible with HS-SR04 software and hardware sizes;
Measuring distance: 5V: 2~500cm / 3.3V: 2~450m; Measuring angle: <15 degrees;
Adopts industrial-grade MCU, working temperature: -20~80’C;
Measurement accuracy: 1%; Resolution: 1mm; Output way: GPIO.

ESP8266 ESP-12E Module Arduino Code

RCW0006-Distance-Sensor.ino

// setup Ultrasonic sensor
#define TRIGPIN 4
#define ECHOPIN 5

int ping()
{
    // pause for 50ms between scans
    delay(50);

    // send ping
    digitalWrite(TRIGPIN, LOW);
    delayMicroseconds(2);
    digitalWrite(TRIGPIN, HIGH);
    delayMicroseconds(10);
    digitalWrite(TRIGPIN, LOW);

    // read echo
    long duration = pulseIn(ECHOPIN, HIGH);

    // convert distance to cm
    unsigned int centimetres = int(duration / 2 / 29.1);

    return centimetres;
}
void setup() {
    Serial.begin(115200);
    Serial.println(" RCW-0006 Ultrasonic Distance Sensor");

    // set the trig pin to output (send sound waves)
    pinMode(TRIGPIN, OUTPUT);

    // set the echo pin to input (receive sound waves)
    pinMode(ECHOPIN, INPUT);

}

void loop() {
    // get distance from obstacle straight ahead
    unsigned int distance = ping();
    Serial.print("Distance(cm): "); Serial.println(distance);
    delay(2000);
}

Leave a Reply