How to use an Ultrasonic Sensor in Tinkercad

Поделиться
HTML-код
  • Опубликовано: 10 сен 2024

Комментарии • 44

  • @user-pb7mu8fj8s
    @user-pb7mu8fj8s 3 года назад +2

    You have saved my life young man

  • @agon1766
    @agon1766 4 года назад +4

    Hi there. Thank you very much for your time and effort to show us this kind of projects. Very useful.

  • @nehapathare3519
    @nehapathare3519 4 года назад +2

    The LED blinks Green even if the object is beyond the range of the sensor.What changes should i make in the code?

    • @shahzoorkhan7091
      @shahzoorkhan7091 3 года назад +1

      Add an else statement at the end and light up any 2 LEDs to make a custom color

  • @oanikuttan5563
    @oanikuttan5563 3 года назад +4

    const int pingPin = 7;
    const int red=11;
    const int blue=10;
    int green=9;
    void setup() {
    // initialize serial communication:
    Serial.begin(9600);
    pinMode(red,OUTPUT);
    pinMode(blue,OUTPUT);
    pinMode(green,OUTPUT);
    }
    void loop() {
    // establish variables for duration of the ping, and the distance result
    // in inches and centimeters:
    long duration, inches, cm;
    // The PING))) is triggered by a HIGH pulse of 2 or more microseconds.
    // Give a short LOW pulse beforehand to ensure a clean HIGH pulse:
    pinMode(pingPin, OUTPUT);
    digitalWrite(pingPin, LOW);
    delayMicroseconds(2);
    digitalWrite(pingPin, HIGH);
    delayMicroseconds(5);
    digitalWrite(pingPin, LOW);
    // The same pin is used to read the signal from the PING))): a HIGH pulse
    // whose duration is the time (in microseconds) from the sending of the ping
    // to the reception of its echo off of an object.
    pinMode(pingPin, INPUT);
    duration = pulseIn(pingPin, HIGH);
    // convert the time into a distance
    inches = microsecondsToInches(duration);
    cm = microsecondsToCentimeters(duration);
    Serial.print(inches);
    Serial.print("in, ");
    Serial.print(cm);
    Serial.print("cm");
    Serial.println();
    if(inches10 && inches

  • @ArduBlock
    @ArduBlock 2 года назад

    Thanks for the great video on this.

  • @fart578
    @fart578 3 года назад +3

    thanks for this this really helped me out!

  • @digvijayurfduggu986
    @digvijayurfduggu986 4 года назад +3

    It is a very good video

  • @dawudghafar1412
    @dawudghafar1412 3 года назад +1

    Thank you for the help. Appreciate it. 👍

  • @gabydagdag2899
    @gabydagdag2899 Год назад

    Thank you very much

  • @shahzoorkhan7091
    @shahzoorkhan7091 3 года назад

    Please give space between operator and variable . I don't know why but i feel uneasy when somebody does that

  • @dodzillad185
    @dodzillad185 7 лет назад +2

    Great video but I am confused. All of my ultrasonic sensors (hc-sr04) has 4 pins. 1 for gnd, 1 for vcc, 1 for trig and 1 for echo. Is there a way to change the ultrasonic sensor ? All I see is the one u used in this video and that sensor isn't suitable for my project since I don't have the same sensor. Could you help me please?

    • @datalohr
      @datalohr 5 лет назад +1

      here it is with code: www.tinkercad.com/things/k9eioRZ9ofs-ultrason-hc-sr04

  • @majjaravinayentertainments7609
    @majjaravinayentertainments7609 6 лет назад +1

    what is this software

  • @shubhamankush6682
    @shubhamankush6682 4 года назад +1

    hello,
    please tell me how to add sound sensor in tinkercad
    i am not able to find sound sensor in tinkercad

    • @robamitiku8152
      @robamitiku8152 4 года назад +1

      You can add a buzzer (Piezo) from the components, and vary its frequency in the code to make the beep sound

  • @notanoption1793
    @notanoption1793 4 года назад +2

    Can you make the code somewhere to copy?

    • @minghuwang2910
      @minghuwang2910 4 года назад

      You can search the code in google

    • @domingomartinez1536
      @domingomartinez1536  4 года назад

      I put the code in the description

    • @notanoption1793
      @notanoption1793 4 года назад +1

      @@domingomartinez1536 a bit late 😇

    • @domingomartinez1536
      @domingomartinez1536  4 года назад +1

      @@notanoption1793 my bad lol

    • @oanikuttan5563
      @oanikuttan5563 3 года назад

      const int pingPin = 7;
      const int red=11;
      const int blue=10;
      int green=9;
      void setup() {
      // initialize serial communication:
      Serial.begin(9600);
      pinMode(red,OUTPUT);
      pinMode(blue,OUTPUT);
      pinMode(green,OUTPUT);
      }
      void loop() {
      // establish variables for duration of the ping, and the distance result
      // in inches and centimeters:
      long duration, inches, cm;
      // The PING))) is triggered by a HIGH pulse of 2 or more microseconds.
      // Give a short LOW pulse beforehand to ensure a clean HIGH pulse:
      pinMode(pingPin, OUTPUT);
      digitalWrite(pingPin, LOW);
      delayMicroseconds(2);
      digitalWrite(pingPin, HIGH);
      delayMicroseconds(5);
      digitalWrite(pingPin, LOW);
      // The same pin is used to read the signal from the PING))): a HIGH pulse
      // whose duration is the time (in microseconds) from the sending of the ping
      // to the reception of its echo off of an object.
      pinMode(pingPin, INPUT);
      duration = pulseIn(pingPin, HIGH);
      // convert the time into a distance
      inches = microsecondsToInches(duration);
      cm = microsecondsToCentimeters(duration);
      Serial.print(inches);
      Serial.print("in, ");
      Serial.print(cm);
      Serial.print("cm");
      Serial.println();
      if(inches10 && inches

  • @mariomora7480
    @mariomora7480 4 года назад +1

    Which resistance did u used?

  • @manjulareddy3047
    @manjulareddy3047 4 года назад +1

    Can you show programming in blocks?

  • @MenACE_135
    @MenACE_135 4 года назад +1

    Can you do 1 with the hc sensor?

    • @domingomartinez1536
      @domingomartinez1536  4 года назад +1

      Its in the description

    • @MenACE_135
      @MenACE_135 4 года назад +1

      @@domingomartinez1536 can u help me with my school problems? My ICT teacher wants us to make led green blink if under 90cm and led brown will blink if the distance is 40cm using the hc sensor... Pleaze your my only hope.

    • @MenACE_135
      @MenACE_135 4 года назад

      @@domingomartinez1536 notice

    • @MenACE_135
      @MenACE_135 4 года назад

      @@domingomartinez1536 notice please

    • @MenACE_135
      @MenACE_135 4 года назад

      @@domingomartinez1536 not me

  • @moja6180
    @moja6180 4 года назад +1

    code pls

  • @nerdygeek8947
    @nerdygeek8947 3 года назад

    Bro I can understand the lag and the fans running in the bg because I have a 10 yr old laptop

  • @laraangelica99
    @laraangelica99 5 лет назад +1

    alguem traduz ou me explica porfavor

  • @arthgamer8730
    @arthgamer8730 6 лет назад +1

    arduino 1.8.5