Skip to main content

Class SimulatedSpstSwitch

Represents a simulated SPST switch

Assembly: Meadow.Foundation.dll​
View Source​
Declaration
public class SimulatedSpstSwitch : ISwitch, ISensor<bool>, ISensor

Implements:
Meadow.Peripherals.Switches.ISwitch, Meadow.Peripherals.Sensors.ISensor<System.Boolean>, Meadow.Peripherals.Sensors.ISensor

Properties​

IsOn​

Describes whether or not the switch circuit is closed/connected (IsOn = true), or open (IsOn = false).

View Source​
Declaration
public bool IsOn { get; }

Methods​

Read()​

Convenience method to get the current sensor reading

View Source​
Declaration
public Task<bool> Read()
Returns​

System.Threading.Tasks.Task<System.Boolean>

SetState(bool)​

Sets the state of the simulated switch

View Source​
Declaration
public void SetState(bool newState)
Parameters​
TypeName
System.BooleannewState

Events​

Changed​

Raised when the switch circuit is opened or closed.

View Source​
Declaration
public event EventHandler? Changed
Event Type​

System.EventHandler

Implements​

  • Meadow.Peripherals.Switches.ISwitch
  • Meadow.Peripherals.Sensors.ISensor<System.Boolean>
  • Meadow.Peripherals.Sensors.ISensor