Remarks

Mb10x0
Status Status badge: in-progress
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Sensors.Distance.Mb10x0
Mb10x0 sensor;

public MeadowApp()
{
    Console.WriteLine("Initialize hardware...");

    sensor = new Mb10x0(Device, Device.SerialPortNames.Com4);

    while (true)
    {
        sensor.ReadSerial();

        Thread.Sleep(500);
    }
}

Sample project(s) available on GitHub

|

Code Example

Mb10x0 sensor;

public override Task Initialize()
{
    Console.WriteLine("Initialize...");

    sensor = new Mb10x0(Device, Device.SerialPortNames.Com4);

    return Task.CompletedTask;
}

public override Task Run()
{
    while (true)
    {
        sensor.ReadSerial();

        Thread.Sleep(500);
    }

    return Task.CompletedTask;
}

Sample project(s) available on GitHub

Characteristic Locus
Inheritance System.Object ObservableBase<Length> SensorBase<Length> > Mb10x0
Implements IRangeFinder
Inherited Members SensorBase<Length>.Updated SensorBase<Length>.samplingLock SensorBase<Length>.SamplingTokenSource SensorBase<Length>.Conditions SensorBase<Length>.IsSampling SensorBase<Length>.UpdateInterval SensorBase<Length>.RaiseEventsAndNotify(IChangeResult<>) SensorBase<Length>.Read() ObservableBase<Length>.observers ObservableBase<Length>.NotifyObservers(IChangeResult<>) Meadow.Foundation.ObservableBase<Length>.Subscribe(IObserver<>) Meadow.Foundation.ObservableBase<Length>.CreateObserver(Action<>, System.Nullable<Predicate<IChangeResult<UNIT>>>)
Namespace Meadow.Foundation.Sensors.Distance
Assembly Mb10x0.dll

Syntax

public class Mb10x0 : SensorBase<Length>, IRangeFinder

Constructors

Mb10x0(ISerialController, SerialPortName)

Creates a new Mb10x0 device on the specified serial port.

Declaration
public Mb10x0(ISerialController device, SerialPortName portName)

Parameters

Type Name Description
ISerialController device
SerialPortName portName

Mb10x0(ISerialPort)

Creates a new Mb10x0 device on the specified serial port.

Declaration
public Mb10x0(ISerialPort serialPort)

Parameters

Type Name Description
ISerialPort serialPort

Properties

Baud

Declaration
public int Baud { get; }

Property Value

Type Description
System.Int32

Distance

The distance to the measured object.

Declaration
public Length? Distance { get; protected set; }

Property Value

Type Description
System.Nullable<Length>

Methods

MeasureDistance()

Declaration
public void MeasureDistance()

ReadSensor()

Declaration
protected override Task<Length> ReadSensor()

Returns

Type Description
Task<Length>

Overrides

Meadow.Foundation.SensorBase<Length>.ReadSensor()

ReadSerial()

Declaration
public Length ReadSerial()

Returns

Type Description
Length

Events

DistanceUpdated

Declaration
public event EventHandler<IChangeResult<Length>> DistanceUpdated

Event Type

Type Description
EventHandler<IChangeResult<Length>>