Remarks
SF-SR02 | |
---|---|
Status | Not working |
Source code | GitHub |
NuGet package | Not published |
The SF-SR02 ultrasonic sensor uses sonar to determine distance to an object (like bats). It offers excellent non-contact range detection with high accuracy and stable readings in an easy-to-use package.
Sample projects available on GitHub
Characteristic | Locus |
---|---|
Inheritance | System.Object > Sfsr02 |
Namespace | Meadow.Foundation.Sensors.Distance |
Assembly | SFSR02.dll |
Syntax
public class Sfsr02 : IRangeFinder
Constructors
Sfsr02(IBiDirectionalPort)
Create a new SFSR02 object
Declaration
public Sfsr02(IBiDirectionalPort triggerEchoPort)
Parameters
Type | Name | Description |
---|---|---|
IBiDirectionalPort | triggerEchoPort |
Sfsr02(IIODevice, IPin)
Create a new SFSR02 object with an IO Device
Declaration
public Sfsr02(IIODevice device, IPin triggerEchoPin)
Parameters
Type | Name | Description |
---|---|---|
IIODevice | device | |
IPin | triggerEchoPin |
Fields
tickStart
Declaration
protected long tickStart
Field Value
Type | Description |
---|---|
System.Int64 |
triggerEchoPort
Trigger/Echo Pin
Declaration
protected IBiDirectionalPort triggerEchoPort
Field Value
Type | Description |
---|---|
IBiDirectionalPort |
Properties
Conditions
Declaration
public DistanceConditions Conditions { get; }
Property Value
Type | Description |
---|---|
DistanceConditions |
CurrentDistance
Returns current distance detected in cm.
Declaration
public float CurrentDistance { get; }
Property Value
Type | Description |
---|---|
System.Single |
MaximumDistance
Maximum valid distance in cm (CurrentDistance returns -1 if above).
Declaration
public float MaximumDistance { get; }
Property Value
Type | Description |
---|---|
System.Single |
MinimumDistance
Minimum valid distance in cm (CurrentDistance returns -1 if below).
Declaration
public float MinimumDistance { get; }
Property Value
Type | Description |
---|---|
System.Single |
Methods
MeasureDistance()
Sends a trigger signal
Declaration
public void MeasureDistance()
Subscribe(IObserver<DistanceConditionChangeResult>)
Declaration
public IDisposable Subscribe(IObserver<DistanceConditionChangeResult> observer)
Parameters
Type | Name | Description |
---|---|---|
System.IObserver<DistanceConditionChangeResult> | observer |
Returns
Type | Description |
---|---|
System.IDisposable |
Events
DistanceDetected
Raised when an received a rebound trigger signal
Declaration
public event EventHandler<DistanceEventArgs> DistanceDetected
Event Type
Type | Description |
---|---|
System.EventHandler<DistanceEventArgs> |
Updated
Declaration
public event EventHandler<DistanceConditionChangeResult> Updated
Event Type
Type | Description |
---|---|
System.EventHandler<DistanceConditionChangeResult> |