package
1.15.0
Repository: https://github.com/mike1808/gobot.git
Documentation: pkg.go.dev

# README

I2C

This package provides drivers for i2cdevices. It must be used along with an adaptor such as firmata that supports the needed interfaces for i2c devices.

Getting Started

Installing

go get -d -u gobot.io/x/gobot/...

Hardware Support

Gobot has a extensible system for connecting to hardware devices. The following i2c devices are currently supported:

  • Adafruit Motor Hat
  • ADS1015 Analog to Digital Converter
  • ADS1115 Analog to Digital Converter
  • ADXL345 Digital Accelerometer
  • BH1750 Digital Luminosity/Lux/Light Sensor
  • BlinkM LED
  • BME280 Barometric Pressure/Temperature/Altitude/Humidity Sensor
  • BMP180 Barometric Pressure/Temperature/Altitude Sensor
  • BMP280 Barometric Pressure/Temperature/Altitude Sensor
  • DRV2605L Haptic Controller
  • Grove Digital Accelerometer
  • GrovePi Expansion Board
  • Grove RGB LCD
  • HMC6352 Compass
  • INA3221 Voltage Monitor
  • JHD1313M1 LCD Display w/RGB Backlight
  • L3GD20H 3-Axis Gyroscope
  • LIDAR-Lite
  • MCP23017 Port Expander
  • MMA7660 3-Axis Accelerometer
  • MPL115A2 Barometer
  • MPU6050 Accelerometer/Gyroscope
  • PCA9685 16-channel 12-bit PWM/Servo Driver
  • SHT3x-D Temperature/Humidity
  • SSD1306 OLED Display Controller
  • TSL2561 Digital Luminosity/Lux/Light Sensor
  • Wii Nunchuck Controller

More drivers are coming soon...

Using A Different Bus or Address

You can set a different I2C address or I2C bus than the default when initializing your I2C drivers by using optional parameters. Here is an example:

blinkm := i2c.NewBlinkMDriver(e, i2c.WithBus(0), i2c.WithAddress(0x09))

# Functions

NewAdafruitMotorHatDriver initializes the internal DCMotor and StepperMotor types.
NewADS1015Driver creates a new driver for the ADS1015 (12-bit ADC) Largely inspired by: https://github.com/adafruit/Adafruit_Python_ADS1x15.
NewADS1115Driver creates a new driver for the ADS1115 (16-bit ADC).
NewADXL345Driver creates a new driver with specified i2c interface Params: conn Connector - the Adaptor to use with this Driver Optional params: i2c.WithBus(int): bus to use with this driver i2c.WithAddress(int): address to use with this driver .
NewBH1750Driver creates a new driver with specified i2c interface Params: conn Connector - the Adaptor to use with this Driver Optional params: i2c.WithBus(int): bus to use with this driver i2c.WithAddress(int): address to use with this driver .
NewBlinkMDriver creates a new BlinkMDriver.
NewBME280Driver creates a new driver with specified i2c interface.
NewBMP180Driver creates a new driver with the i2c interface for the BMP180 device.
NewBMP280Driver creates a new driver with specified i2c interface.
NewCCS811Driver creates a new driver for the CCS811 (air quality sensor).
NewCCS811MeasMode returns a new instance of the package ccs811 measurement mode configuration.
NewCCS811Status returns a new instance of the package ccs811 status definiton.
NewConfig returns a new I2c Config.
NewConnection creates and returns a new connection to a specific i2c device on a bus and address.
NewDisplayBuffer creates a new DisplayBuffer.
NewDRV2605LDriver creates a new driver for the DRV2605L device.
NewGroveAccelerometerDriver creates a new driver with specified i2c interface Params: conn Connector - the Adaptor to use with this Driver Optional params: i2c.WithBus(int): bus to use with this driver i2c.WithAddress(int): address to use with this driver .
NewGroveLcdDriver creates a new driver with specified i2c interface.
NewGrovePiDriver creates a new driver with specified i2c interface Params: conn Connector - the Adaptor to use with this Driver Optional params: i2c.WithBus(int): bus to use with this driver i2c.WithAddress(int): address to use with this driver .
NewHMC6352Driver creates a new driver with specified i2c interface Params: conn Connector - the Adaptor to use with this Driver Optional params: i2c.WithBus(int): bus to use with this driver i2c.WithAddress(int): address to use with this driver .
NewINA3221Driver creates a new driver with the specified i2c interface.
NewJHD1313M1Driver creates a new driver with specified i2c interface.
NewL3GD20HDriver creates a new Gobot driver for the L3GD20H I2C Triple-Axis Gyroscope.
NewLIDARLiteDriver creates a new driver for the LIDARLite I2C LIDAR device.
NewMCP23017Driver creates a new Gobot Driver to the MCP23017 i2c port expander.
NewMMA7660Driver creates a new driver with specified i2c interface Params: conn Connector - the Adaptor to use with this Driver Optional params: i2c.WithBus(int): bus to use with this driver i2c.WithAddress(int): address to use with this driver .
NewMPL115A2Driver creates a new Gobot Driver for an MPL115A2 I2C Pressure/Temperature sensor.
NewMPU6050Driver creates a new Gobot Driver for an MPU6050 I2C Accelerometer/Gyroscope.
NewPCA9685Driver creates a new driver with specified i2c interface Params: conn Connector - the Adaptor to use with this Driver Optional params: i2c.WithBus(int): bus to use with this driver i2c.WithAddress(int): address to use with this driver .
NewSHT3xDriver creates a new driver with specified i2c interface Params: conn Connector - the Adaptor to use with this Driver Optional params: i2c.WithBus(int): bus to use with this driver i2c.WithAddress(int): address to use with this driver .
NewSSD1306Driver creates a new SSD1306Driver.
NewTH02Driver creates a new driver with specified i2c interface.
NewTSL2561Driver creates a new driver for the TSL2561 device.
NewWiichuckDriver creates a WiichuckDriver with specified i2c interface.
WithAddress sets which address to use as a optional param.
WithADS1x15DataRate option sets the ADS1x15Driver data rate option.
WithADS1x15Gain option sets the ADS1x15Driver gain option.
WithBus sets which bus to use as a optional param.
WithCCS811MeasMode sets the sampling rate of the device.
WithCCS811NTCResistance sets reistor value used in the temperature calculations.This resistor must be placed between pin 4 and pin 8 of the chip.
WithMCP23017Bank option sets the MCP23017Driver bank option.
WithMCP23017Disslw option sets the MCP23017Driver Disslw option.
WithMCP23017Haen option sets the MCP23017Driver Haen option.
WithMCP23017Intpol option sets the MCP23017Driver Intpol option.
WithMCP23017Mirror option sets the MCP23017Driver Mirror option.
WithMCP23017Odr option sets the MCP23017Driver Odr option.
WithMCP23017Seqop option sets the MCP23017Driver Seqop option.
WithSSD1306DisplayHeight option sets the SSD1306Driver DisplayHeight option.
WithSSD1306DisplayWidth option sets the SSD1306Driver DisplayWidth option.
WithSSD1306ExternalVCC option sets the SSD1306Driver ExternalVCC option.
WithTSL2561AutoGain option turns on TSL2561Driver auto gain.
WithTSL2561Gain16X option sets the TSL2561Driver gain to 16X.
WithTSL2561Gain1X option sets the TSL2561Driver gain to 1X.
WithTSL2561IntegrationTime101MS option sets the TSL2561Driver integration time to 101ms.
WithTSL2561IntegrationTime13MS option sets the TSL2561Driver integration time to 13ms.
WithTSL2561IntegrationTime402MS option sets the TSL2561Driver integration time to 402ms.

# Constants

1.
1.
0.
2.
3.
2.
0.
AddressNotInitialized is the initial value for an address.
ADS1x15DefaultAddress is the default I2C address for the ADS1x15 components.
+-16 g).
+-2 g.
+-4 g.
+-8 g.
0.10 Hz.
0.20 Hz.
0.39 Hz.
0.78 Hz.
1.56 Hz.
100 Hz.
12.5 Hz.
1600 Hz.
200 Hz.
25 Hz.
3.13 Hz.
3200 Hz.
400 Hz.
50 Hz.
6.25 Hz.
800 Hz.
R/W, 00000000, Axis enable control for activity and inactiv ity detection.
R, 00000000, Source of single tap/double tap.
R/W, 00001010, Data rate and power mode control.
R/W, 00000000, Data format control.
R, 00000000, X-Axis Data 0.
R, 00000000, X-Axis Data 1.
R, 00000000, Y-Axis Data 0.
R, 00000000, Y-Axis Data 1.
R, 00000000, Z-Axis Data 0.
R, 00000000, Z-Axis Data 1.
R, 11100101, Device ID.
R/W, 00000000, Tap duration.
R/W, 00000000, FIFO control.
R, 00000000, FIFO status.
R/W, 00000000, Interrupt enable control.
R/W, 00000000, Interrupt mapping control.
R, 00000010, Source of interrupts.
R/W, 00000000, Tap latency.
R/W, 00000000, X-axis offset.
R/W, 00000000, Y-axis offset.
R/W, 00000000, Z-axis offset.
R/W, 00000000, Power-saving features control.
R/W, 00000000, Axis control for single tap/double tap.
R/W, 00000000, Activity threshold.
R/W, 00000000, Free-fall threshold.
R/W, 00000000, Inactivity threshold.
R/W, 00000000, Tap threshold.
R/W, 00000000, Free-fall time.
R/W, 00000000, Inactivity time.
R/W, 00000000, Tap window.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
BMP180HighResolution is a high oversampling mode of the pressure measurement.
BMP180Standard is the standard oversampling mode of the pressure measurement.
BMP180UltraHighResolution is the highest oversampling mode of the pressure measurement.
BMP180UltraLowPower is the lowest oversampling mode of the pressure measurement.
BusNotInitialized is the initial value for a bus.
C event when the Wiichuck "C" button is pressed.
Operating modes which dictate how often measurements are being made.
Operating modes which dictate how often measurements are being made.
Operating modes which dictate how often measurements are being made.
Operating modes which dictate how often measurements are being made.
Operating modes which dictate how often measurements are being made.
Commands format.
Commands format.
Commands format.
Commands format.
Commands format.
Commands format.
Operating modes, for use in SetMode().
Operating modes, for use in SetMode().
Operating modes, for use in SetMode().
Operating modes, for use in SetMode().
Operating modes, for use in SetMode().
Operating modes, for use in SetMode().
Operating modes, for use in SetMode().
Operating modes, for use in SetMode().
Error event.
No description provided by the author
No description provided by the author
No description provided by the author
Joystick event when the Wiichuck joystick is moved.
L3GD20HScale2000dps is the 2000 degress-per-second scale.
L3GD20HScale250dps is the 250 degress-per-second scale.
L3GD20HScale500dps is the 500 degress-per-second scale.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
SHT3xAccuracyHigh is the high accuracy and slowest sample setting.
SHT3xAccuracyLow is the faster, but lower accuracy sample setting.
SHT3xAccuracyMedium is the medium accuracy and speed sample setting.
SHT3xAddressA is the default address of device.
SHT3xAddressB is the optional address of device.
TH02Address is the default address of device.
TH02ConfigReg is the configuration register.
High Accuracy.
Lower Accuracy.
TSL2561AddressFloat - the address of the device when address pin is floating.
TSL2561AddressHigh - the address of the device when address pin is high.
TSL2561AddressLow - the address of the device when address pin is low.
16x gain.
No gain.
101ms.
13.7ms.
402ms.
Z event when the Wiichuck "C" button is pressed.

# Variables

CustomLCDChars is a map of CGRAM characters that can be loaded into a LCD screen to display custom characters.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

AdafruitMotorHatDriver is a driver for the DC+Stepper Motor HAT from Adafruit.
ADS1x15Driver is the Gobot driver for the ADS1015/ADS1115 ADC.
ADXL345Driver is the gobot driver for the digital accelerometer ADXL345 Datasheet EN: http://www.analog.com/media/en/technical-documentation/data-sheets/ADXL345.pdf Datasheet JP: http://www.analog.com/media/jp/technical-documentation/data-sheets/ADXL345_jp.pdf Ported from the Arduino driver https://github.com/jakalada/Arduino-ADXL345.
BH1750Driver is a driver for the BH1750 digital Ambient Light Sensor IC for I²C bus interface.
BlinkMDriver is a Gobot Driver for a BlinkM LED.
BME280Driver is a driver for the BME280 temperature/humidity sensor.
BMP180Driver is the gobot driver for the Bosch pressure sensor BMP180.
BMP280Driver is a driver for the BMP280 temperature/pressure sensor.
CCS811Driver is the Gobot driver for the CCS811 (air quality sensor) Adafruit breakout board.
CCS811MeasMode represents the current measurement configuration.The following definitions were taken from the bit fields of the ccs811RegMeasMode defined inhttps://ams.com/documents/20143/36005/CCS811_DS000459_6-00.pdf/c7091525-c7e5-37ac-eedb-b6c6828b0dcf#page=16.
CCS811Status represents the current status of the device defined by the ccs811RegStatus.
DisplayBuffer represents the display buffer intermediate memory.
DRV2605LDriver is the gobot driver for the TI/Adafruit DRV2605L Haptic Controller Device datasheet: http://www.ti.com/lit/ds/symlink/drv2605l.pdf Inspired by the Adafruit Python driver by Sean Mealin.
GroveAccelerometerDriver is a driver for the MMA7660 accelerometer.
GroveLcdDriver is a driver for the Jhd1313m1 LCD display which has two i2c addreses, one belongs to a controller and the other controls solely the backlight.
GrovePiDriver is a driver for the GrovePi+ for I²C bus interface.
HMC6352Driver is a Driver for a HMC6352 digital compass.
INA3221Driver is a driver for the INA3221 three-channel current and bus voltage monitoring device.
JHD1313M1Driver is a driver for the Jhd1313m1 LCD display which has two i2c addreses, one belongs to a controller and the other controls solely the backlight.
L3GD20HDriver is the gobot driver for the Adafruit Triple-Axis Gyroscope L3GD20H.
LIDARLiteDriver is the Gobot driver for the LIDARLite I2C LIDAR device.
MCP23017Config contains the device configuration for the IOCON register.
MCP23017Driver contains the driver configuration parameters.
No description provided by the author
MPL115A2Driver is a Gobot Driver for the MPL115A2 I2C digitial pressure/temperature sensor.
MPU6050Driver is a new Gobot Driver for an MPU6050 I2C Accelerometer/Gyroscope.
PCA9685Driver is a Gobot Driver for the PCA9685 16-channel 12-bit PWM/Servo controller.
SHT3xDriver is a Driver for a SHT3x humidity and temperature sensor.
SSD1306Driver is a Gobot Driver for a SSD1306 Display.
SSD1306Init contains the initialization settings for the ssd1306 display.
TH02Driver is a Driver for a TH02 humidity and temperature sensor.
No description provided by the author
TSL2561Driver is the gobot driver for the Adafruit Digital Luminosity/Lux/Light Sensor Datasheet: http://www.adafruit.com/datasheets/TSL2561.pdf Ported from the Adafruit driver at https://github.com/adafruit/Adafruit_TSL2561 by K.
No description provided by the author

# Interfaces

Config is the interface which describes how a Driver can specify optional I2C params such as which I2C bus it wants to use.
Connector lets Adaptors provide the interface for Drivers to get access to the I2C buses on platforms that support I2C.
I2cDevice is the interface to a specific i2c bus.
No description provided by the author

# Type aliases

AdafruitDirection declares a type for specification of the motor direction.
AdafruitStepStyle declares a type for specification of the stepper motor rotation.
BMP180OversamplingMode is the oversampling ratio of the pressure measurement.
CCS811DriveMode type.
Connection is a connection to an I2C device with a specified address on a specific bus.
DRV2605Mode - operating mode.
INA3221Channel type that defines which INA3221 channel to read from.
L3GD20HScale is the scale sensitivity of degrees-per-second.
TSL2561Gain is the type of all valid gain settings.
TSL2561IntegrationTime is the type of all valid integration time settings.