class Ultrasonic - ultrasonic ranging sensor


from ezblock import Ultrasonic, Pin

trig = Pin("D0")
echo = Pin("D1")

ultrasonic = Ultrasonic(trig, echo)             # create an  Ultrasonic object from  pin
val =                         # read an analog value


class ezblock.Ultrasonic(trig, echo) Create an Ultrasonic object associated with the given pin. This allows you to then read distance values.


  • read - Read the value on the analog pin and return it. The returned value will be between 0 and 4095., echo)