func (m *MotorDriver) Toggle() (err error) {
	if m.IsOn() {
		err = m.Off()
	} else {
		err = m.On()
	}
	return
}
Toggle sets the motor to the opposite of it's current state
package gpio
import (
	"github.com/hybridgroup/gobot"
)
type MotorDriver struct {
	name             string
	connection       DigitalWriter
	SpeedPin         string
	SwitchPin        string
	DirectionPin     string
	ForwardPin       string
	BackwardPin      string
	CurrentState     byte
	CurrentSpeed     byte
	CurrentMode      string
	CurrentDirection string
}
func NewMotorDriver(a DigitalWriter, name string, speedPin string) *MotorDriver {
	return &MotorDriver{
		name:             name,
		connection:       a,
		SpeedPin:         speedPin,
		CurrentState:     0,
		CurrentSpeed:     0,
		CurrentMode:      "digital",
		CurrentDirection: "forward",
	}
}
func (m *MotorDriver) Name() string { return m.name }
func (m *MotorDriver) Connection() gobot.Connection { return m.connection.(gobot.Connection) }
func (m *MotorDriver) Start() (errs []error) { return }
func (m *MotorDriver) Halt() (errs []error) { return }
func (m *MotorDriver) Off() (err error) {
	if m.isDigital() {
		err = m.changeState(0)
	} else {
		err = m.Speed(0)
	}
	return
}
func (m *MotorDriver) On() (err error) {
	if m.isDigital() {
		err = m.changeState(1)
	} else {
		if m.CurrentSpeed == 0 {
			m.CurrentSpeed = 255
		}
		err = m.Speed(m.CurrentSpeed)
	}
	return
}
func (m *MotorDriver) Min() (err error) {
	return m.Off()
}
func (m *MotorDriver) Max() (err error) {
	return m.Speed(255)
}
func (m *MotorDriver) IsOn() bool {
	if m.isDigital() {
		return m.CurrentState == 1
	}
	return m.CurrentSpeed > 0
}
func (m *MotorDriver) IsOff() bool {
	return !m.IsOn()
}