Meadow.Foundation.Grove.Sensors.Buttons.LEDButton
LEDButton | |
---|---|
Status | |
Source code | GitHub |
NuGet package |
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 |
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