Skip to main content

Class KeyScanButton

Represents a AS1115 key scan button

Assembly: As1115.dll​
View Source​
Declaration
public class KeyScanButton : IButton, ISensor<bool>, ISensor

Implements:
Meadow.Peripherals.Sensors.Buttons.IButton, Meadow.Peripherals.Sensors.ISensor<System.Boolean>, Meadow.Peripherals.Sensors.ISensor

Properties​

LongClickedThreshold​

Get or set the long click threshold

View Source​
Declaration
public TimeSpan LongClickedThreshold { get; set; }

State​

Get current button state

View Source​
Declaration
public bool State { get; }

Fields​

buttonPressStart​

Maximum DateTime value when the button was just pushed

View Source​
Declaration
protected DateTime buttonPressStart

Methods​

Update(bool)​

Update the button state true for pressed, false for released

View Source​
Declaration
public void Update(bool state)
Parameters​
TypeName
System.Booleanstate

RaiseClicked()​

Raised when the button circuit is re-opened after it has been closed (at the end of a �press�).

View Source​
Declaration
protected virtual void RaiseClicked()

RaisePressStarted()​

Raised when a press starts (the button is pushed down; circuit is closed).

View Source​
Declaration
protected virtual void RaisePressStarted()

RaisePressEnded()​

Raised when a press ends (the button is released; circuit is opened).

View Source​
Declaration
protected virtual void RaisePressEnded()

RaiseLongClicked()​

Raised when the button circuit is pressed for at least 500ms.

View Source​
Declaration
protected virtual void RaiseLongClicked()

Read()​

Convenience method to get the current sensor reading

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

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

Events​

PressStarted​

Raised when a press starts (the button is pushed down)

View Source​
Declaration
public event EventHandler PressStarted
Event Type​

System.EventHandler

PressEnded​

Raised when a press ends (the button is released)

View Source​
Declaration
public event EventHandler PressEnded
Event Type​

System.EventHandler

Clicked​

Raised when the button circuit is re-opened after it has been closed (at the end of a press)

View Source​
Declaration
public event EventHandler Clicked
Event Type​

System.EventHandler

LongClicked​

Raised when the button circuit is pressed for LongPressDuration

View Source​
Declaration
public event EventHandler LongClicked
Event Type​

System.EventHandler

Implements​

  • Meadow.Peripherals.Sensors.Buttons.IButton
  • Meadow.Peripherals.Sensors.ISensor<System.Boolean>
  • Meadow.Peripherals.Sensors.ISensor