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() {
Wire.begin();
Serial.begin(9600);
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(finger);
Serial.print(": ");
Serial.print(data);
Serial.print(",");
}
Serial.println();
}
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,
Jai.