DNETCoreGPIO 1.0.5
See the version list below for details.
dotnet add package DNETCoreGPIO --version 1.0.5
NuGet\Install-Package DNETCoreGPIO -Version 1.0.5
<PackageReference Include="DNETCoreGPIO" Version="1.0.5" />
paket add DNETCoreGPIO --version 1.0.5
#r "nuget: DNETCoreGPIO, 1.0.5"
// Install DNETCoreGPIO as a Cake Addin #addin nuget:?package=DNETCoreGPIO&version=1.0.5 // Install DNETCoreGPIO as a Cake Tool #tool nuget:?package=DNETCoreGPIO&version=1.0.5
DNETCoreGPIO
A .NET Core app to run on the RPi. Works with both Raspian and Win10 IoT-Core unchanged. Exemplifies System.Devices.GPIO and Iot.Device.Bindings Nuget packages. Provided as Visual Studio 2022 project.
Usage
Create a .NET Console app:
Run dotnet new console
Add the library as a Nuget package
Run dotnet add package DNETCoreGPIO --version 1.0.x
NB: Use the current version, in place of 1.0.x,check at https://www.nuget.org/packages/DNETCoreGPIO/
Can use * to get latest.
Change the 7th line in Program.cs as below:
namespace ConsoleGPIOApp
{
class Program
{
static void Main(string[] args)
{
DotNetCoreCoreGPIO.Program.Main(args);
}
}
}
Build and run the app with the required parameter.(See below)
This is based upon the GitHUb Repository: dotnet/iot<br> Whereas the samples therein (from which this is taken, and extended) use library sources in that repository, this uses the associated Nuget packages.
New Feature: Can change GPIO mappings as second parameter. eg "17,4,26,22,27,17,19", which is the current settings.
Which map to led,button,dht22,motoren, motorfwd,motorrev,relay respectively.
Parameters
Run the app with the following parameters
- Led and Button press
- Temperature with BME280 sensor ..2Do
- Temperature and Humidity with DHTxx sensor ..2Do
- Temperature and Humidity with DHT22 sensor using 1-Wire <
- LED driven by Software PWM.
- H-Bridge Motor using L293D
Whilst the above run continously or until stopped the following only do a single pass.
These are used by TRIGGERcmd
11/12. Relay On/Off
14. Temperature and Humidity with DHT22 sensor using 1-Wire. Get single value and write to /tmp/temperature.txt. See TRIGGERcmd.GetTempDHTxx1Wire()
15. Temperature Pressure and Humidity with BME280. Get single values and write to /tmp/temperature.txt
The following control the motor as in 6 but as separate commands.
- Motor Partial off: Set Fwd and Rev to off
- Motor Forward
- Motor Reverse
- Motor Enable
- Motor Disable
- Motor Off (Fwd=Rev=En=off)
Run
NB: Look at circuit diagrams here on GitHub
Running Led and Button
Pins:
- LED Anode to GPIO17
- Button1 to GPIO4
- Ground (LED Cathode and Button2) (to the one in between. <br>ie Pins 11 7 and 9 resectively.
- Reminder that the LED requires a current limiting resistor.
SW driven LED
As above
DHT22
See circuit diagram under Circuits.
Active pin is is GPIO26. I'm using a 10K pullup to that.
Some conversions fail, which output as dots. Doesn't work on IOT-Core.
Motor
See circuit diagram in Circuits folder, left part. <br>Pins (L293D pins in brackets):
- Enable GPIO 22 (E1) (L293D Enble 1)
- Reverse GPIO 27 (I1)
- Forward GPIO 17 (I2)
Relay
See circuit diagram in Circuits folder, right part. <br>Pins (L293D pins in brackets):
- On/Off GPIO 19 (E2) (L233D Enable 2)
- Lo (I4)
- Hi (I3)
- I4 and I3 only need to be in opposite state
- Probably want Motor disabled if is low voltage and relay is 12V coil voltage.
BME280
- See circuit diagram rpi-bmp280_i2c.png for 4 pin connections.
- If unit is more than 4 pins see BME280Sampler.Get() for extra pins.
- Also see there wrt enabling I2C on RPi and for checking.
More on My Blog
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net5.0
- Figgle (>= 0.4.0)
- Iot.Device.Bindings (>= 2.1.0)
- System.Device.Gpio (>= 2.1.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
1.3.3 | 551 | 3/30/2022 | |
1.3.2 | 410 | 3/29/2022 | |
1.3.1 | 410 | 3/27/2022 | |
1.3.0 | 401 | 3/26/2022 | |
1.2.2 | 415 | 3/20/2022 | |
1.2.1 | 408 | 3/20/2022 | |
1.2.0 | 437 | 3/20/2022 | |
1.1.2 | 434 | 3/20/2022 | |
1.1.1 | 434 | 3/19/2022 | |
1.1.0 | 418 | 3/19/2022 | |
1.0.9 | 423 | 3/19/2022 | |
1.0.8 | 431 | 3/11/2022 | |
1.0.7 | 436 | 3/11/2022 | |
1.0.6 | 432 | 3/9/2022 | |
1.0.5 | 405 | 3/9/2022 | |
1.0.4 | 417 | 3/1/2022 | |
1.0.3 | 410 | 2/28/2022 | |
1.0.1 | 417 | 2/28/2022 |
Can add GPIO mappings as second parameter.