Class SimulatedCurrentSensor
Represents a simulated current sensor
Assembly: Meadow.Foundation.dll
View Source
public class SimulatedCurrentSensor : SimulatedSamplingSensorBase<Current>, ISimulatedSensor, ISamplingCurrentSensor, ISamplingSensor<Current>, ISamplingSensor, ICurrentSensor, ISensor<Current>, ISensor
Inheritance: System.Object -> Meadow.Foundation.Sensors.SimulatedSensorBase -> Meadow.Foundation.Sensors.SimulatedSamplingSensorBase<UNIT>
Implements:
Meadow.Peripherals.Sensors.ISimulatedSensor, Meadow.Peripherals.Sensors.ISamplingCurrentSensor, Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Current>, Meadow.Peripherals.Sensors.ISamplingSensor, Meadow.Peripherals.Sensors.ICurrentSensor, Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Current>, Meadow.Peripherals.Sensors.ISensor
Properties
Current
Last value read from the Current sensor.
View Source
public Current? Current { get; }
SupportedBehaviors
Gets an array of supported simulation behaviors for the sensor.
View Source
public override SimulationBehavior[] SupportedBehaviors { get; }
ValueType
Gets the type of the sensor's value.
View Source
public override Type ValueType { get; }
Methods
SetSensorValue(object)
Sets the simulated value for the sensor.
View Source
public override void SetSensorValue(object value)
Parameters
| Type | Name | Description |
|---|---|---|
System.Object | value | The value to set for the sensor. |
GenerateSimulatedValue(SimulationBehavior)
Generates a value based on the provided behavior
View Source
protected override Current GenerateSimulatedValue(SimulationBehavior behavior)
Returns
Meadow.Units.Current
Parameters
| Type | Name | Description |
|---|---|---|
Meadow.Peripherals.Sensors.SimulationBehavior | behavior | The behavior to use when generating a value |
ReadCurrent()
Reads the instantaneous current of the sensor
View Source
public ValueTask<Current> ReadCurrent()
Returns
System.Threading.Tasks.ValueTask<Meadow.Units.Current>
Implements
Meadow.Peripherals.Sensors.ISimulatedSensorMeadow.Peripherals.Sensors.ISamplingCurrentSensorMeadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Current>Meadow.Peripherals.Sensors.ISamplingSensorMeadow.Peripherals.Sensors.ICurrentSensorMeadow.Peripherals.Sensors.ISensor<Meadow.Units.Current>Meadow.Peripherals.Sensors.ISensor