Remarks

LEDButton
Status Status badge: working
Source code GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Grove.Sensors.Buttons.LEDButton

Code Example

LEDButton ledButton;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    ledButton = new LEDButton(buttonPin: Device.Pins.D12, ledPin: Device.Pins.D13);

    ledButton.LongClickedThreshold = TimeSpan.FromMilliseconds(1500);

    ledButton.Clicked += (s, e) =>
    {
        Resolver.Log.Info("Grove Button clicked");
        ledButton.IsLedOn = !ledButton.IsLedOn;
    };

    ledButton.LongClicked += (s, e) =>
    {
        Resolver.Log.Info("Grove Button long clicked");
    };

    return Task.CompletedTask;
}

Sample project(s) available on GitHub

Wiring Example

LEDButton Meadow Pin
GND GND
VCC 3.3V
RX D01
TX D00
Characteristic Locus
Inheritance object PushButtonBase PushButton > LEDButton
Implements IButton ISensor<bool> IDisposable
Inherited Members PushButton.DefaultDebounceDuration PushButton.DefaultGlitchDuration PushButton.DebounceDuration PushButton.DigitalIn PushButtonBase.DefaultLongPressThreshold PushButtonBase.PressStarted PushButtonBase.PressEnded PushButtonBase.Clicked PushButtonBase.LongClicked PushButtonBase.ShouldDisposeInput PushButtonBase.ButtonPressStart PushButtonBase.LongClickedThreshold PushButtonBase.State PushButtonBase.GetNormalizedState(bool) PushButtonBase.UpdateEvents(bool) PushButtonBase.RaiseClicked() PushButtonBase.RaisePressStarted() PushButtonBase.RaisePressEnded() PushButtonBase.RaiseLongClicked() PushButtonBase.Read() PushButtonBase.Dispose() object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString()
Namespace Meadow.Foundation.Grove.Sensors.Buttons
Assembly LEDButton.dll

Syntax

public class LEDButton : PushButton, IButton, ISensor<bool>, IDisposable

Constructors

LEDButton(IDigitalInterruptPort, IDigitalOutputPort)

Creates an LEDButton driver

Declaration
public LEDButton(IDigitalInterruptPort buttonPort, IDigitalOutputPort ledPort)

Parameters

Type Name Description
IDigitalInterruptPort buttonPort
IDigitalOutputPort ledPort

Remarks

LEDButton
Status Status badge: working
Source code GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Grove.Sensors.Buttons.LEDButton

Code Example

LEDButton ledButton;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    ledButton = new LEDButton(buttonPin: Device.Pins.D12, ledPin: Device.Pins.D13);

    ledButton.LongClickedThreshold = TimeSpan.FromMilliseconds(1500);

    ledButton.Clicked += (s, e) =>
    {
        Resolver.Log.Info("Grove Button clicked");
        ledButton.IsLedOn = !ledButton.IsLedOn;
    };

    ledButton.LongClicked += (s, e) =>
    {
        Resolver.Log.Info("Grove Button long clicked");
    };

    return Task.CompletedTask;
}

Sample project(s) available on GitHub

Wiring Example

LEDButton Meadow Pin
GND GND
VCC 3.3V
RX D01
TX D00

LEDButton(IPin, IPin, ResistorMode)

Creates an LEDButton driver

Declaration
public LEDButton(IPin buttonPin, IPin ledPin, ResistorMode resistorMode = ResistorMode.InternalPullUp)

Parameters

Type Name Description
IPin buttonPin
IPin ledPin
ResistorMode resistorMode

Remarks

LEDButton
Status Status badge: working
Source code GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Grove.Sensors.Buttons.LEDButton

Code Example

LEDButton ledButton;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    ledButton = new LEDButton(buttonPin: Device.Pins.D12, ledPin: Device.Pins.D13);

    ledButton.LongClickedThreshold = TimeSpan.FromMilliseconds(1500);

    ledButton.Clicked += (s, e) =>
    {
        Resolver.Log.Info("Grove Button clicked");
        ledButton.IsLedOn = !ledButton.IsLedOn;
    };

    ledButton.LongClicked += (s, e) =>
    {
        Resolver.Log.Info("Grove Button long clicked");
    };

    return Task.CompletedTask;
}

Sample project(s) available on GitHub

Wiring Example

LEDButton Meadow Pin
GND GND
VCC 3.3V
RX D01
TX D00

Properties

IsLedOn

Gets/Sets the status of the LED when is on(true) or off(false)

Declaration
public bool IsLedOn { get; set; }

Property Value

Type Description
bool

Remarks

LEDButton
Status Status badge: working
Source code GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Grove.Sensors.Buttons.LEDButton

Code Example

LEDButton ledButton;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    ledButton = new LEDButton(buttonPin: Device.Pins.D12, ledPin: Device.Pins.D13);

    ledButton.LongClickedThreshold = TimeSpan.FromMilliseconds(1500);

    ledButton.Clicked += (s, e) =>
    {
        Resolver.Log.Info("Grove Button clicked");
        ledButton.IsLedOn = !ledButton.IsLedOn;
    };

    ledButton.LongClicked += (s, e) =>
    {
        Resolver.Log.Info("Grove Button long clicked");
    };

    return Task.CompletedTask;
}

Sample project(s) available on GitHub

Wiring Example

LEDButton Meadow Pin
GND GND
VCC 3.3V
RX D01
TX D00