Skip to main content

Class SpdtSwitch

Represents a simple, two position, Single-Pole-Dual-Throw (SPDT) switch that closes a circuit to either ground/common or high depending on position

Assembly: Meadow.Foundation.dll
View Source
public class SpdtSwitch : ISwitch, ISensor<bool>, ISensor, IDisposable

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

Properties

IsOn

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

View Source
public bool IsOn { get; protected set; }

DigitalInputPort

Returns the DigitalInputPort.

View Source
protected IDigitalInterruptPort DigitalInputPort { get; set; }

IsDisposed

Is the object disposed

View Source
public bool IsDisposed { get; }

Methods

DigitalInChanged(object, DigitalPortResult)

Event handler when switch value has been changed

View Source
protected void DigitalInChanged(object sender, DigitalPortResult e)
Parameters
TypeName
System.Objectsender
Meadow.Hardware.DigitalPortResulte

Read()

Convenience method to get the current sensor reading

View Source
public Task<bool> Read()
Returns

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

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

View Source
public void Dispose()

Dispose(bool)

Dispose of the object

View Source
protected virtual void Dispose(bool disposing)
Parameters
TypeNameDescription
System.BooleandisposingIs disposing

Events

Changed

Raised when the switch circuit is opened or closed.

View Source
public event EventHandler Changed
Event Type

System.EventHandler

Implements

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