procsys.waveshare8ch 0.1.1

Additional Details

These two packages do not include the shared library, required for the wrapper to function.

There is a newer version of this package available.
See the version list below for details.
dotnet add package procsys.waveshare8ch --version 0.1.1
                    
NuGet\Install-Package procsys.waveshare8ch -Version 0.1.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="procsys.waveshare8ch" Version="0.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="procsys.waveshare8ch" Version="0.1.1" />
                    
Directory.Packages.props
<PackageReference Include="procsys.waveshare8ch" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add procsys.waveshare8ch --version 0.1.1
                    
#r "nuget: procsys.waveshare8ch, 0.1.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package procsys.waveshare8ch@0.1.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=procsys.waveshare8ch&version=0.1.1
                    
Install as a Cake Addin
#tool nuget:?package=procsys.waveshare8ch&version=0.1.1
                    
Install as a Cake Tool

Waveshare 8-Channel Relay Examples in C#

This repository contains example code for controlling the Waveshare 8-Channel Relay module using C#. The goal of this project is to provide a simple and clear starting point for developers who want to integrate the relay module into their .NET applications.

Goals

  • Demonstrate how to interface with the Waveshare 8-Channel Relay module using C#.
  • Provide reusable and well-documented code for relay control.
  • Help developers understand the basics of GPIO communication in .NET.

Features

  • Turn individual relays on or off.
  • Control multiple relays simultaneously.
  • Example code for common use cases.

Prerequisites

  • A Waveshare 8-Channel Relay module.
  • A device with GPIO support (e.g., Raspberry Pi).
  • .NET 8.0 or later installed on your system.

Getting Started

  1. Clone this repository:

    git clone https://github.com/simoncahill/waveshare_8ch_relay_examples.git
    cd waveshare_8ch_relay_examples/csharp
    
  2. Open the project in your favorite IDE (e.g., Visual Studio or Visual Studio Code).

  3. Build the project:

    dotnet build
    

Basic Usage

The example code demonstrates how to initialize the relay module and control individual relays. Below is a brief overview:

  • Initialize the Relay Module: Use the provided RelayController class to set up communication with the relay module.
  • Control Relays: Call methods like TurnOnRelay(int relayNumber) or TurnOffRelay(int relayNumber) to control specific relays.

Example Code Snippet

var relayController = new RelayController();
relayController.Initialize();

// Turn on relay 1
relayController.TurnOnRelay(1);

// Turn off relay 1
relayController.TurnOffRelay(1);

// Turn on all relays
relayController.TurnOnAllRelays();

Tips

  • Ensure the GPIO pins are correctly configured and match the relay module's requirements.
  • Run the application with appropriate permissions to access GPIO (e.g., sudo on Linux).
  • Refer to the Waveshare 8-Channel Relay documentation for hardware setup details.

Contributing

Contributions are welcome! Feel free to open issues or submit pull requests to improve the examples.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Initial release of the library.