Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
18 lines (13 sloc) 475 Bytes

The servo assembly has support for measuring distances using ultrasound sensors.

Reading a distance

Assuming you wired the ultrasound sensor's trigger pin to digital pin 6 on the servo assembly, and the echo pin to pin 7, you can query the distance from the sensor using:

r.servo_board.read_ultrasound(6, 7)
>>> 0.524

{{% notice info %}} The returned distance is in metres. {{% /notice %}}

You can’t perform that action at this time.