Untitled
raw download clone
TEXT
views 5
,
size 1368 b
package main

import (
        "log"
		"github.com/tarm/serial"
		"os"
)

func sendCommand(command string) {
	c := &serial.Config{Name: os.Args[1], Baud: 9600}
	s, err := serial.OpenPort(c)

	command = command + string(13) + string(10)
	_, err = s.Write([]byte(command))
	if err != nil {
			log.Fatal(err)
	}
}

func main() {
	sendCommand("^Q20,3")
	sendCommand("^W32")
	sendCommand("^^H10")
	sendCommand("^P1")
	sendCommand("^S3")
	sendCommand("^AT")
	sendCommand("^C1")
	sendCommand("^R0")
	sendCommand("~Q+0")
	sendCommand("^O0")
	sendCommand("^D0")
	sendCommand("^E16")
	sendCommand("~R255")
	sendCommand("^L")
	sendCommand("Dy2-me-dd")
	sendCommand("Th:m:s")
	sendCommand("Y300,51,Image6-87")
	sendCommand("Y603,151,Image3-25")
	sendCommand("W26,53,5,2,M0,8,9,44,0")
	sendCommand(os.Args[2])
	sendCommand(os.Args[4])
	sendCommand(os.Args[3])
	sendCommand("AC,18,315,1,1,0,0E,www.comelitgroup.com")
	sendCommand("AG,17,344,1,1,0,0E,SN:")
	sendCommand("AG,16,407,1,1,0,0E,MAC:")
	sendCommand("AF,138,356,1,1,0,0E,"+os.Args[2])
	sendCommand("AE,190,426,1,1,0,0E,"+os.Args[3])
	sendCommand("AD,312,137,1,1,0,0E,Comelit Group S.p.A.")
	sendCommand("AD,312,175,1,1,0,0E,Via Don Arrigoni 5,")
	sendCommand("AD,312,213,1,1,0,0E,24020 Rovetta")
	sendCommand("AD,312,251,1,1,0,0E,S. Lorenzo BG Italy")
	sendCommand("E")
}
close fullscreen
Login or Register to edit or fork this paste. It's free.