Table of Contents

get ultrasonic sensor distance (cm) trig () echo ()

get ultrasonic sensor distance

Description

Get ultrasonic sensor distance (cm) trig () echo () block is a reporter block available in sensors extension for evive and all Arduino boards. The block reports the distance of the nearest object from an ultrasonic sensor. It returns distance in cm. The trigger pin and echo pin are connected to a digital pin of evive which can be selected from the drop-down menu.

evive Notes Icon
Note: This block is available in both Upload mode and Stage mode.

Example

  1. This script displays the distance on the evive TFT display.
    get ultrasonic sensor distance example

Example

Learn to Interface an ultrasonic sensor with Arduino, use ultrasonic sensor to measure distance and much more

Ultrasonic Sensor and It’s working

An ultrasonic sensor is an electronic device that measures the distance of a target object by emitting ultrasonic sound waves, and converts the reflected sound into an electrical signal.

How does it work?

Ultrasonic waves travel faster than the speed of audible sound (i.e. the sound that humans can hear). Ultrasonic sensors have two main components: the transmitter (which emits the sound using piezoelectric crystals) and the receiver (which encounters the sound after it has traveled to and from the target). It works by emitting a sound wave that travels through the air and bounces back to the sensor if it encounters an obstacle or object.

Circuit Diagram

Code

  1. From event  drag when flag clicked 
  2. From  control drag forever block.
  3. From  look  drag  say()
  4. From sensor pellet of Arduino drag get ultrasonic sensor distance trig() echo()

Script

Output

Read More
All articles loaded
No more articles to load