Public projects 1

Respected projects 1

Comments 3

  • How to Make an Ultrasonic Ruler with Arduino UNO and HC-SR04 over 2 years ago

    Yeah maybe i make a another project on it!

  • How to Make an Ultrasonic Ruler with Arduino UNO and HC-SR04 over 3 years ago

    Thanks Mihai Valentin for your suggestion. It will be taken into account.

  • Ultrasonic Range Detector Using Arduino and SR-04F over 3 years ago

    I have just modified the code which displays inches, centimetres and millimetres.Down below. Just change your trig pin to 2 and echo pin to 4. and the code also reads the distance slowly so you could read it. To see the distance just go to Tools -> Serial monitor or just press ctrl+shift+M for windows and for mac is command+shift+M. Contact me if have any doubts. Plz take a look at my project too.

    const int trigPin = 2;
    const int echoPin = 4;
    void setup() {
    void loop()
    long duration, inches, cm, mm;
    pinMode(trigPin, OUTPUT);
    digitalWrite(trigPin, LOW);
    digitalWrite(trigPin, HIGH);
    digitalWrite(trigPin, LOW);
    pinMode(echoPin, INPUT);
    duration = pulseIn(echoPin, HIGH);
    inches = microsecondsToInches(duration);
    cm = microsecondsToCentimeters(duration);
    mm = microsecondsToMillimeters(duration);
    Serial.print("in, ");
    Serial.print("cm, ");
    Serial.print(" mm");
    long microsecondsToInches(long microseconds)
    {return microseconds / 74 / 2;}
    long microsecondsToCentimeters(long microseconds)
    {return microseconds / 29 / 2;}
    long microsecondsToMillimeters(long microseconds)
    {return microseconds / 2.9 / 2;}

Add projectSign up / Login