func (a *AnalogSensorDriver) Start() (errs []error) {
	value := 0
	go func() {
		for {
			newValue, err := a.Read()
			if err != nil {
				a.Publish(a.Event(Error), err)
			} else if newValue != value && newValue != -1 {
				value = newValue
				a.Publish(a.Event(Data), value)
			}
			select {
			case <-time.After(a.interval):
			case <-a.halt:
				return
			}
		}
	}()
	return
}
Start starts the AnalogSensorDriver and reads the Analog Sensor at the given interval.
Emits the Events:
Data int - Event is emitted on change and represents the current reading from the sensor.
Error error - Event is emitted on error reading from the sensor.
package gpio
import (
	"time"
	"github.com/hybridgroup/gobot"
)
type AnalogSensorDriver struct {
	name       string
	pin        string
	halt       chan bool
	interval   time.Duration
	connection AnalogReader
	gobot.Eventer
	gobot.Commander
}
func NewAnalogSensorDriver(a AnalogReader, name string, pin string, v ...time.Duration) *AnalogSensorDriver {
	d := &AnalogSensorDriver{
		name:       name,
		connection: a,
		pin:        pin,
		Eventer:    gobot.NewEventer(),
		Commander:  gobot.NewCommander(),
		interval:   10 * time.Millisecond,
		halt:       make(chan bool),
	}
	if len(v) > 0 {
		d.interval = v[0]
	}
	d.AddEvent(Data)
	d.AddEvent(Error)
	d.AddCommand("Read", func(params map[string]interface{}) interface{} {
		val, err := d.Read()
		return map[string]interface{}{"val": val, "err": err}
	})
	return d
}