Skip to content

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

Notifications You must be signed in to change notification settings

Menaver/Menaver.IoT.Devices

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

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

Keynotes

Supported devices

Examples

More examples of using the IoT devices can be found in the test project Menaver.IoT.Devices.Tests.

Basic LED

Scheme

Code

List<Led> 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

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

    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<int> RunAsync()
    {
        using var keypad4x4 = new MatrixKeyboard(_inputs, _outputs, _keyMap);

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

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

About

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

Topics

Resources

Stars

Watchers

Forks

Languages