2014-06-10 10:01:53 +08:00
|
|
|
# I2C
|
2014-04-26 18:11:51 +08:00
|
|
|
|
2023-05-20 20:25:21 +08:00
|
|
|
This package provides drivers for [i2c](https://en.wikipedia.org/wiki/I%C2%B2C)devices. It must be used along with an
|
|
|
|
adaptor such as [Tinker Board](https://gobot.io/documentation/platforms/tinkerboard/) that supports the needed
|
|
|
|
interfaces for i2c devices.
|
2014-04-26 18:11:51 +08:00
|
|
|
|
|
|
|
## Getting Started
|
|
|
|
|
2023-06-05 00:36:55 +08:00
|
|
|
Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md)
|
2014-06-10 10:01:53 +08:00
|
|
|
|
2014-04-26 18:11:51 +08:00
|
|
|
## Hardware Support
|
2023-05-20 20:25:21 +08:00
|
|
|
|
2014-04-26 18:11:51 +08:00
|
|
|
Gobot has a extensible system for connecting to hardware devices. The following i2c devices are currently supported:
|
|
|
|
|
2023-10-30 02:35:26 +08:00
|
|
|
- Adafruit 1109 2x16 RGB-LCD with 5 keys
|
|
|
|
- Adafruit 2327 16-Channel PWM/Servo HAT Hat
|
|
|
|
- Adafruit 2348 DC and Stepper Motor Hat
|
2017-04-24 23:58:30 +08:00
|
|
|
- ADS1015 Analog to Digital Converter
|
2017-04-27 22:13:29 +08:00
|
|
|
- ADS1115 Analog to Digital Converter
|
2018-02-14 16:40:39 +08:00
|
|
|
- ADXL345 Digital Accelerometer
|
2018-01-12 23:26:21 +08:00
|
|
|
- BH1750 Digital Luminosity/Lux/Light Sensor
|
2017-01-03 17:22:06 +08:00
|
|
|
- BlinkM LED
|
2017-04-01 19:51:36 +08:00
|
|
|
- BME280 Barometric Pressure/Temperature/Altitude/Humidity Sensor
|
2017-01-03 17:22:06 +08:00
|
|
|
- BMP180 Barometric Pressure/Temperature/Altitude Sensor
|
2017-04-01 19:51:36 +08:00
|
|
|
- BMP280 Barometric Pressure/Temperature/Altitude Sensor
|
2020-09-26 18:07:17 +08:00
|
|
|
- BMP388 Barometric Pressure/Temperature/Altitude Sensor
|
2017-02-24 15:19:20 +08:00
|
|
|
- DRV2605L Haptic Controller
|
2021-03-12 02:43:17 +08:00
|
|
|
- Generic driver for read and write values to/from register address
|
2016-09-25 20:08:18 +08:00
|
|
|
- Grove Digital Accelerometer
|
2018-08-24 00:07:08 +08:00
|
|
|
- GrovePi Expansion Board
|
2016-09-25 20:08:18 +08:00
|
|
|
- Grove RGB LCD
|
|
|
|
- HMC6352 Compass
|
2022-09-01 01:40:31 +08:00
|
|
|
- HMC5883L 3-Axis Digital Compass
|
2017-05-05 15:27:08 +08:00
|
|
|
- INA3221 Voltage Monitor
|
2017-01-03 17:22:06 +08:00
|
|
|
- JHD1313M1 LCD Display w/RGB Backlight
|
|
|
|
- L3GD20H 3-Axis Gyroscope
|
2017-02-24 15:19:20 +08:00
|
|
|
- LIDAR-Lite
|
2016-09-25 20:08:18 +08:00
|
|
|
- MCP23017 Port Expander
|
|
|
|
- MMA7660 3-Axis Accelerometer
|
2022-09-21 01:35:55 +08:00
|
|
|
- MPL115A2 Barometric Pressure/Temperature
|
2014-12-14 10:50:09 +08:00
|
|
|
- MPU6050 Accelerometer/Gyroscope
|
2021-03-12 02:43:17 +08:00
|
|
|
- PCA9501 8-bit I/O port with interrupt, 2-kbit EEPROM
|
2022-11-14 01:47:19 +08:00
|
|
|
- PCA953x LED Dimmer for PCA9530 (2-bit), PCA9533 (4-bit), PCA9531 (8-bit), PCA9532 (16-bit)
|
2017-06-24 02:18:02 +08:00
|
|
|
- PCA9685 16-channel 12-bit PWM/Servo Driver
|
2022-06-13 01:00:09 +08:00
|
|
|
- PCF8583 clock and calendar or event counter, 240 x 8-bit RAM
|
2022-03-25 01:40:26 +08:00
|
|
|
- PCF8591 8-bit 4xA/D & 1xD/A converter
|
2020-03-17 09:08:06 +08:00
|
|
|
- SHT2x Temperature/Humidity
|
2017-01-03 17:21:09 +08:00
|
|
|
- SHT3x-D Temperature/Humidity
|
2017-04-01 19:51:36 +08:00
|
|
|
- SSD1306 OLED Display Controller
|
2017-02-24 15:19:20 +08:00
|
|
|
- TSL2561 Digital Luminosity/Lux/Light Sensor
|
2014-04-26 18:11:51 +08:00
|
|
|
- Wii Nunchuck Controller
|
2021-03-12 02:43:17 +08:00
|
|
|
- YL-40 Brightness/Temperature sensor, Potentiometer, analog input, analog output Driver
|
2014-04-26 18:11:51 +08:00
|
|
|
|
|
|
|
More drivers are coming soon...
|
2017-02-10 19:01:44 +08:00
|
|
|
|
|
|
|
## Using A Different Bus or Address
|
|
|
|
|
2023-05-20 20:25:21 +08:00
|
|
|
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:
|
2017-02-10 19:01:44 +08:00
|
|
|
|
|
|
|
```go
|
|
|
|
blinkm := i2c.NewBlinkMDriver(e, i2c.WithBus(0), i2c.WithAddress(0x09))
|
|
|
|
```
|