modbusrelay

package module
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2024 License: MIT Imports: 3 Imported by: 0

README

modbusrelay

Documentation

Overview

modbusrelay package implements control for Modbus relay modules.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RelayController

type RelayController struct {
	// contains filtered or unexported fields
}

RelayController represents a Modbus relay controller.

func (*RelayController) Close

func (rc *RelayController) Close() error

Close closes the Modbus connection.

func (*RelayController) SetRelayOff

func (rc *RelayController) SetRelayOff(relayNum uint16) error

SetRelayOff turns off the specified relay.

func (*RelayController) SetRelayOn

func (rc *RelayController) SetRelayOn(relayNum uint16) error

SetRelayOn turns on the specified relay.

type RelayControllerInterface added in v1.0.1

type RelayControllerInterface interface {
	SetRelayOn(relayNum uint16) error
	SetRelayOff(relayNum uint16) error
	Close() error
}

RelayControllerInterface defines methods for controlling relays.

func NewRelayController

func NewRelayController(device string, baudRate uint, slaveID byte) (RelayControllerInterface, error)

NewRelayController creates a new RelayController instance.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL