5. Usage
5.1
With Arduino
Grove - I2C ADC has two interfaces: input socket (J2) and output socket (J1). Connect an analog sensor to
its input socket and connect the I2C ADC to Arduino or Seeeduino also via Grove cables.
Take Grove - Gas Sensor as an example, and now we learn how to read sensor data using Grove - I2C ADC.
The hardware installation should be like this:
Now you can read the gas sensor value using the code below.
#include <Wire.h>
#include <Streaming.h>
#define ADDR_ADC121
#define V_REF 3.00
#define REG_ADDR_RESULT
#define REG_ADDR_ALERT
#define REG_ADDR_CONFIG
#define REG_ADDR_LIMITL
#define REG_ADDR_LIMITH
#define REG_ADDR_HYST
#define REG_ADDR_CONVL
0x55
0x00
0x01
0x02
0x03
0x04
0x05
0x06
6
Need help?
Do you have a question about the Grove-I2C ADC and is the answer not in the manual?