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).
- Host: GitHub
- URL: https://github.com/menaver/menaver.iot.devices
- Owner: Menaver
- Created: 2024-05-31T10:46:16.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-26T16:08:45.000Z (almost 2 years ago)
- Last Synced: 2025-03-24T03:24:48.407Z (over 1 year ago)
- Topics: arduino, dotnet, iot, raspberrypi
- Language: C#
- Homepage: https://www.nuget.org/packages/Menaver.IoT.Devices
- Size: 32.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
.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
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}");
}
}
```