

Most ultrasonic distance sensors aren't waterproof which can be a problem if you need your project to withstand the elements outdoors. No need to worry any more! We have developed waterproof ultrasonic distance sensors with a waterproof sealed emitter.
If you have any questions on this product please feel free to contact us.
*Disclaimer: The images are merely illustrative.
If you have any questions on this product please feel free to contact us.
*Disclaimer: The images are merely illustrative.
|
|
# define ECHOPIN 2 // Pin to receive echo pulse # define TRIGPIN 3 // Pin to send trigger pulse void setup() { Serial.begin(9600); pinMode(ECHOPIN, INPUT); pinMode(TRIGPIN, OUTPUT); digitalWrite(ECHOPIN, HIGH); } void loop() { digitalWrite(TRIGPIN, LOW); // Set the trigger pin to low for 2uS delayMicroseconds(2); digitalWrite(TRIGPIN, HIGH); // Send a 10uS high to trigger ranging delayMicroseconds(10); digitalWrite(TRIGPIN, LOW); // Send pin low again int distance = pulseIn(ECHOPIN, HIGH, 26000); // Read in times pulse distance = distance / 58; Serial.print(distance); Serial.println(" cm"); delay(50); // Wait 50mS before next ranging }
Related products
Most ultrasonic distance sensors aren't waterproof which can be a problem if you need your project to withstand the elements outdoors. No need to worry any more! We have developed waterproof ultrasonic distance sensors with a waterproof sealed emitter.