The System.Device.Gpio package supports general-purpose I/O (GPIO) pins, PWM, I2C, SPI and related interfaces for interacting with low level hardware pins to control hardware sensors, displays and input devices on single-board-computers; Raspberry Pi, BeagleBoard, ODROID, and other single-board-computers that are supported by Linux or Windows and can run .NET. Depending on the OS and hardware, various low-level drivers are available. Additionally, hardware interfaces connected trough Serial ports or USB are also supported.
$ dotnet add package System.Device.GpioNo README available.