import "gobot.io/x/gobot/platforms/firmata/client"
Package client provies a client for interacting with microcontrollers using the Firmata protocol https://github.com/firmata/protocol.
const ( Input = 0x00 Output = 0x01 Analog = 0x02 Pwm = 0x03 Servo = 0x04 )
Pin Modes
const ( ProtocolVersion byte = 0xF9 SystemReset byte = 0xFF DigitalMessage byte = 0x90 DigitalMessageRangeStart byte = 0x90 DigitalMessageRangeEnd byte = 0x9F AnalogMessage byte = 0xE0 AnalogMessageRangeStart byte = 0xE0 AnalogMessageRangeEnd byte = 0xEF ReportAnalog byte = 0xC0 ReportDigital byte = 0xD0 PinMode byte = 0xF4 StartSysex byte = 0xF0 EndSysex byte = 0xF7 CapabilityQuery byte = 0x6B CapabilityResponse byte = 0x6C PinStateQuery byte = 0x6D PinStateResponse byte = 0x6E AnalogMappingQuery byte = 0x69 AnalogMappingResponse byte = 0x6A StringData byte = 0x71 I2CRequest byte = 0x76 I2CReply byte = 0x77 I2CConfig byte = 0x78 FirmwareQuery byte = 0x79 I2CModeWrite byte = 0x00 I2CModeRead byte = 0x01 I2CModeContinuousRead byte = 0x02 I2CModeStopReading byte = 0x03 ServoConfig byte = 0x70 )
Sysex Codes
Errors
type Client struct { FirmwareName string ProtocolVersion string ConnectTimeout time.Duration gobot.Eventer // contains filtered or unexported fields }
Client represents a client connection to a firmata board
New returns a new Client
AnalogMappingQuery sends the AnalogMappingQuery sysex code.
AnalogWrite writes value to pin.
CapabilitiesQuery sends the CapabilityQuery sysex code.
func (b *Client) Connect(conn io.ReadWriteCloser) (err error)
Connect connects to the Client given conn. It first resets the firmata board then continuously polls the firmata board for new information when it's available.
Connected returns the current connection state of the Client
Connecting returns true when the client is connecting
DigitalWrite writes value to pin.
Disconnect disconnects the Client
FirmwareQuery sends the FirmwareQuery sysex code.
I2cConfig configures the delay in which a register can be read from after it has been written to.
I2cRead reads numBytes from address once.
I2cWrite writes data to address.
PinStateQuery sends a PinStateQuery for pin.
Pins returns all available pins
ProtocolVersionQuery sends the ProtocolVersion sysex code.
ReportAnalog enables or disables analog reporting for pin, a non zero state enables reporting
ReportDigital enables or disables digital reporting for pin, a non zero state enables reporting
Reset sends the SystemReset sysex code.
ServoConfig sets the min and max pulse width for servo PWM range
SetPinMode sets the pin to mode.
WriteSysex writes an arbitrary Sysex command to the microcontroller.
I2cReply represents the response from an I2cReply message
Pin represents a pin on the firmata board
Package client imports 8 packages (graph) and is imported by 2 packages. Updated 2017-12-22. Refresh now. Tools for package owners.