An open API service indexing awesome lists of open source software.

https://github.com/menaver/menaver.iot.devices

.NET implementations that help for better interaction with various IoT devices (LED, displays, keyboards, sensors, etc).
https://github.com/menaver/menaver.iot.devices

arduino dotnet iot raspberrypi

Last synced: 6 months ago
JSON representation

.NET implementations that help for better interaction with various IoT devices (LED, displays, keyboards, sensors, etc).

Awesome Lists containing this project

README

          

# Overview

.NET implementations that help for better interaction with various IoT devices (LED, displays, keyboards, sensors, etc).

## Keynotes
- Platform: netstandard2.0;
- Distributed via NuGet (check out [Menaver.IoT.Devices](https://www.nuget.org/packages/Menaver.IoT.Devices))
- This repository [leverages](https://github.com/Menaver/menaver.iot.devices/actions) Github Actions (GHA);

## Supported devices
- 💡 [Light-emitting diode](https://en.wikipedia.org/wiki/Light-emitting_diode) (LED)
- ⌨️ [Matrix Keyboard M×N](https://en.wikipedia.org/wiki/Keyboard_matrix_circuit)
- 📟 [Liquid-crystal display](https://en.wikipedia.org/wiki/Liquid-crystal_display) (LCD): PCF8574, PCF8575, PCA8574, PCA8575
- 🌡️ [Humidity & Temperature Sensor](https://www.mouser.com/datasheet/2/758/DHT11-Technical-Data-Sheet-Translated-Version-1143054.pdf) (DHT): DHT11, DHT12, DHT21, DHT22

# Examples

More examples of using the IoT devices can be found in the test project [Menaver.IoT.Devices.Tests](https://github.com/Menaver/Menaver.IoT.Devices/tree/main/src/Menaver.IoT.Devices.Tests/Programs).

## Basic LED

#### Scheme

#### Code
```cs
List leds = new()
{
new Led(4, Color.Red, false),
};

using var ledPanel = new LedPanel(leds);

ledPanel.SetAll(Color.Red);
await Task.Delay(300);

ledPanel.ResetAll();
await Task.Delay(300);

ledPanel.Toggle(4);
```

## Obtaining Humidity & Temperature data from DHT sensor

#### Scheme

#### Code
```cs
using var dht = new Dht(dataPin: 4, DhtDevice.Dht22);

Console.WriteLine("Waiting for the sensor to response...");

while (true)
{
var temperature = await dht.GetTemperatureAsync(TemperatureUnit.Celsius, CancellationToken.None);
Console.WriteLine($"Temperature: {temperature:F1}\u00B0C");

var humidity = await dht.GetHumidityAsync(CancellationToken.None);
Console.WriteLine($"Humidity: {humidity:F1}%");

await Task.Delay(1000);
}
```

## Matrix Keyboard 4x4

#### Scheme

#### Code
```cs
private static readonly int[] _inputs = { 18, 23, 24, 25 };
private static readonly int[] _outputs = { 10, 22, 27, 17 };

private static readonly char[,] _keyMap =
{
{ '1', '2', '3', 'A' },
{ '4', '5', '6', 'B' },
{ '7', '8', '9', 'C' },
{ '*', '0', '#', 'D' }
};

public static async Task RunAsync()
{
using var keypad4x4 = new MatrixKeyboard(_inputs, _outputs, _keyMap);

while (true)
{
var key = await keypad4x4.ReadKeyAsync();

Console.WriteLine($"Key pressed: {key}");
}
}
```