Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Wire.h>
- #define ADS1110_ADDR 0x48
- void setup() {
- Serial.begin(9600);
- Wire.begin();
- }
- void loop() {
- // Start a single conversion on AIN0 with a gain of 1
- Wire.beginTransmission(ADS1110_ADDR);
- Wire.write(0x85);
- Wire.write(0x83);
- Wire.endTransmission();
- delay(10); // Wait for the conversion to complete
- // Read the conversion result
- Wire.requestFrom(ADS1110_ADDR, 2);
- int16_t result = Wire.read() << 8 | Wire.read();
- float voltage = result * 0.000125; // Convert to voltage
- Serial.println(voltage);
- delay(1000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement