MCPcopy Create free account
hub / github.com/DexterInd/GoPiGo3 / read_ultrasonic

Function read_ultrasonic

Software/Scratch/GoPiGo3Scratch.py:627–633  ·  view source on GitHub ↗
(port="AD1")

Source from the content-addressed store, hash-verified

625 '''
626 distance_sensor_output_str = "Distance Sensor"
627 def read_ultrasonic(port="AD1"):
628 UltraSonicSensor = get_sensor_instance(port, easysensors.UltraSonicSensor)
629 print("reading from ultrasonic sensor on port {}".format(port))
630 distance = UltraSonicSensor.read()
631 if distance == 0:
632 known_sensors[port] = None
633 sensors["{}: distance".format(port)] = distance
634 if regObj.group(SENSOR_DISTANCE_PORT2):
635 port = "AD2"
636 elif regObj.group(SENSOR_DISTANCE_PORT1):

Callers 1

handle_distanceFunction · 0.85

Calls 2

get_sensor_instanceFunction · 0.85
readMethod · 0.45

Tested by

no test coverage detected