MaxBotix MB1013 programming

We have a MB1013 ultrasonic sensor but we don’t know how to properly program it.
Can anybody send us an example of code?
Thanks anyway.

From the MB1013 page on MaxBotix’s website, it looks like it has 3 outputs you can read from: analog voltage, serial, or PWM.

How you use it would depend on how you’ve decided to connect it.

  • Analog can be read with the AnalogInput class. This is probably the most straightforward option.
  • Serial can be used with the SerialPort class. I wouldn’t recommend this.
  • PWM can be read using the Counter::GetPeriod method (plug into the roboRIO DIO pins).

Refer to the datasheet for what pins you need to connect and how distances are mapped.