endTransmission() hang?

Hi, I'm trying to find a way to get around(I think) is a endTransmission() Error in the Sparkfun ADS1015 library. When I unplug my I2C device(Flex Sensor) from my board everything works but when I plug it in it doesn't. Here is my code:

#include <SparkFun_ADS1015_Arduino_Library.h>
#include <Wire.h>

ADS1015 fingerSensor;

void setup() {

if (fingerSensor.begin() /<--hangs here when plugged in/ == false) {
Serial.println("Device not found. Check wiring.");
while (1);

void loop() {
uint16_t data;
for (int finger = 0; finger < 2; finger++) {
data = fingerSensor.getAnalogData(finger);
Serial.print(": ");

I tracked down the line of code in the Sparkfun library .cpp file where I think it's hanging:

if (_i2cPort->endTransmission() != 0)

Line 61 in the .cpp file for ADS1015 library. I was wondering if there is any way to make the code work when my I2C device is plugged in, or do I have to make it into a new Wire.h library like WSWire. I have tried WSWire but it comes up with the error:
/Documents/Arduino/libraries/WSWire/src/WSWire.cpp:24:12: fatal error: twi.h: No such file or directory #include "twi.h" ^~~~~~~ compilation terminated. exit status 1 Error compiling for board Arduino Uno.

Any ideas or solutions would be greatly appreciated.

Thanks a bunch,


When SDA or SCL is shortcut to GND or if SDA is shortcut to SCL, then the Wire.endTransmission() halts the sketch.
If a module is not powered, that might be seen as a shortcut of SDA and SCL to GND.

The Wire library has a low-level timeout, which is not turned on.

You have to fix the hardware of the I2C bus.
Check all the wires and soldering. There is an increasing problem with broken jumper wires. A breadboard can have bad contacts.

You don't have to run your full sketch. Run a I2C Scanner sketch (there is a "i2c_scanner" in the examples in the menu), and try to make that run.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.