Skip to main content

Meadow.Foundation.Grove.Sensors.Buttons.LEDButton

LEDButton
StatusStatus badge: working
Source codeGitHub
NuGet packageNuGet 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

LEDButtonMeadow Pin
GNDGND
VCC3.3V
RXD01
TXD00

Class LEDButton

Represents an LED button

Assembly: LEDButton.dll
View Source
Declaration
public class LEDButton : PushButton, IButton, ISensor<bool>, ISensor, IDisposable

Inheritance: System.Object -> Meadow.Foundation.Sensors.Buttons.PushButtonBase -> Meadow.Foundation.Sensors.Buttons.PushButton

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

Properties

IsLedOn

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

View Source
Declaration
public bool IsLedOn { get; set; }

Implements

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