func (f *FirmataAdaptor) Finalize() (errs []error) {
	if err := f.Disconnect(); err != nil {
		return []error{err}
	}
	return
}
Finalize terminates the firmata connection
package firmata
import (
	"io"
	"strconv"
	"time"
	"github.com/hybridgroup/gobot"
	"github.com/hybridgroup/gobot/platforms/firmata/client"
	"github.com/tarm/goserial"
)
type firmataBoard interface {
	Connect(io.ReadWriteCloser) error
	Disconnect() error
	Pins() []client.Pin
	AnalogWrite(int, int) error
	SetPinMode(int, int) error
	ReportAnalog(int, int) error
	ReportDigital(int, int) error
	DigitalWrite(int, int) error
	I2cRead(int, int) error
	I2cWrite(int, []byte) error
	I2cConfig(int) error
	ServoConfig(int, int, int) error
	Event(string) string
}
type FirmataAdaptor struct {
	name   string
	port   string
	board  firmataBoard
	conn   io.ReadWriteCloser
	openSP func(port string) (io.ReadWriteCloser, error)
	gobot.Eventer
}
func NewFirmataAdaptor(name string, args ...interface{}) *FirmataAdaptor {
	f := &FirmataAdaptor{
		name:  name,
		port:  "",
		conn:  nil,
		board: client.New(),
		openSP: func(port string) (io.ReadWriteCloser, error) {
			return serial.OpenPort(&serial.Config{Name: port, Baud: 57600})
		},
		Eventer: gobot.NewEventer(),
	}
	for _, arg := range args {
		switch arg.(type) {
		case string:
			f.port = arg.(string)
		case io.ReadWriteCloser:
			f.conn = arg.(io.ReadWriteCloser)
		}
	}
	return f
}
func (f *FirmataAdaptor) Connect() (errs []error) {
	if f.conn == nil {
		sp, err := f.openSP(f.Port())
		if err != nil {
			return []error{err}
		}
		f.conn = sp
	}
	if err := f.board.Connect(f.conn); err != nil {
		return []error{err}
	}
	return
}
func (f *FirmataAdaptor) Disconnect() (err error) {
	if f.board != nil {
		return f.board.Disconnect()
	}
	return nil
}