This [sample](Program.cs) demonstrates blinking an LED at a given interval. It repeatedly toggles a GPIO pin on and off, which powers the LED. This sample also demonstrates the most basic usage of the [.NET Core GPIO library](https://dotnet.myget.org/feed/dotnet-corefxlab/package/nuget/System.Devices.Gpio).
### Code
## Run the sample
This sample can be built and run with .NET Core 2.1. Use the following commands from the root of the repo:
```console
cd samples
cd led-blink
dotnet build -c release -o out
sudo dotnet out/led-blink.dll
```
## Run the sample with Docker
This sample can be built and run with Docker. Use the following commands from the root of the repo:
```console
cd samples
cd led-blink
docker build -t led-blink .
docker run --rm -it -v /sys:/sys led-blink
```
## Code
The following code provides write access to a GPIO pin (GPIO 17 in this case):
...
...
@@ -25,7 +47,7 @@ while (true)
}
```
### Breadboard layout
## Breadboard layout
The following [fritzing diagram](rpi-led.fzz) demonstrates how you should wire your device in order to run the [program](Program.cs). It uses the GND and GPIO 17 pins on the Raspberry Pi.