Ultrasonic sensor with python

Does anyone know how to program a ultrasonic sensor with v5 if so do you have the code

You are looking for the Sonar class. It’s pretty easy to use. Set it up with the device panel in Robot Mesh Studio on one of the 3-wire ports (it can only go on A, C, E, or G then also takes up B, D, F, or H for the second wire). Ask for the range with the


distance

method. You can give it a


DistanceUnits

as an argument, otherwise it will return the distance in mm.

Here’s a simple sample program that uses the sonar sensor (ultrasonic rangefinder) using Python.

The above code is still private

John- can you please share the code for v5

Sorry about that. It’s public now.