Coder Social home page Coder Social logo

How to run? about modbus HOT 3 OPEN

goburrow avatar goburrow commented on July 21, 2024
How to run?

from modbus.

Comments (3)

agn-7 avatar agn-7 commented on July 21, 2024 1

Thanks, I set $GOPATH=$HOME/go in .bashrc and do go get github.com/goburrow/modbus.git in gopath location (~/go/) then I do go install github.com/goburrow/modbus/.
Then I create a go project and use go modbus library in my code.

This is my "gopath" tree:

go/
│── src
│   │── own_modbus
│   │   └── modbus.go
│   │
│   │── github.com
    │   └── goburrow
    │       ├── modbus
    │          ├──  . . .
              . . .

And this is my "own_modbus" code:

package main

import ("fmt"
	    "github.com/goburrow/modbus"
)

func main() {
	cli := modbus.TCPClient("192.168.1.150:502")
	res, err := cli.ReadHoldingRegisters(4096, 1)
	fmt.Println(res)
	fmt.Println(err)

}

Is there any "go modbus" documentation and examples such as pymodbus?

from modbus.

ArlenFuCN avatar ArlenFuCN commented on July 21, 2024

Hi ,you don't clone this.
With Golang,you just use "go get " to download this package and install it.
then,in your project,you have to set the "GoPath".
and next, you just "import " this package,you can use this package's method.
about "go get" of goland,I think you can google it.you will get lots of information about it.

from modbus.

nqv avatar nqv commented on July 21, 2024

There is an example: https://github.com/goburrow/modbus#usage
Docs: https://godoc.org/github.com/goburrow/modbus#Client

from modbus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.