/omron-fins-go

omron-fins-go is fins command client written by Go.

Primary LanguageGoMIT LicenseMIT

omron-fins-go Build Status

About

This is fins command client written by Go.

This library support communication to omron PLC from Go application.

##Install

$ go get github.com/hiroeorz/omron-fins-go/fins

Usage

Read DM values sample.

package main

import (
	"fmt"
	"github.com/hiroeorz/omron-fins-go/fins"
	"log"
)

func main() {
	srcAddr := "192.168.0.1:9600" // Host address
	dstAddr := "192.168.0.6:9600"  // PLC address

	// Start listener at first.
	listenChan := fins.Listen(srcAddr)

	// Send ReadDM request (startAddress:100 getCount:10).
	vals, err := fins.ReadDM(listenChan, srcAddr, dstAddr, 100, 10)
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println(vals)
	// => [12799 24752 12799 24768 12799 24784 12799 24800 12799 24816]
}