Meadow.Foundation.Grove.Relays.Relay
Relay | |
---|---|
Status | |
Source code | GitHub |
NuGet package |
Code Example
Relay relay;
public override Task Initialize()
{
Resolver.Log.Info("Initialize...");
relay = new Relay(Device.Pins.D13);
return Task.CompletedTask;
}
public override async Task Run()
{
var state = false;
while (true)
{
state = !state;
Resolver.Log.Info($"- State: {state}");
relay.State = state
? Meadow.Peripherals.Relays.RelayState.Closed
: Meadow.Peripherals.Relays.RelayState.Open;
await Task.Delay(500);
}
}
```
[Sample project(s) available on GitHub](https://github.com/WildernessLabs/Meadow.Foundation.Grove/tree/main/Source/Relay/Sample/Relay_Sample)
### Wiring Example
| Relay | Meadow Pin |
|--------|------------|
| GND | GND |
| VCC | 3.3V |
| RX | D01 |
| TX | D00 |
# Class Relay
Represents a Relay
###### **Assembly**: Relay.dll
###### [View Source](https://github.com/WildernessLabs/Meadow.Foundation.Grove/blob/main/Source/Relay/Driver/Relay.cs#L8)
```csharp title="Declaration"
public class Relay : Relay, IRelay
Inheritance: System.Object
-> Meadow.Foundation.Relays.Relay
Implements:
Meadow.Peripherals.Relays.IRelay
Implements
Meadow.Peripherals.Relays.IRelay