Hi,
Hoping someone might have an idea why my TCS34725 sensor is not found on my Boron board. I have 3 of the TCS34725, with headers soldered on, and none of them are found on the I2C bus of the device. The LED ligth on the TCS34725 is illuminated so I know I have power. I've tried the sample code from the particle library, Adafruit_TCS34725, and no luck. Hoping someone might have an idea, below is the code I am running - falls into the "No TCS34725 found ... check your connections" and the I2C scanner reports no device found.
#include "Particle.h"
#include "Adafruit_TCS34725.h"
#include <math.h>
boolean commonAnode = false;
char szInfo[128];
Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_50MS, TCS34725_GAIN_4X);
// Let Device OS manage the connection to the Particle Cloud
SYSTEM_MODE(AUTOMATIC);
// Run the application and system concurrently in separate threads
SYSTEM_THREAD(ENABLED);
// Show system, cloud connectivity, and application logs over USB
// View logs with CLI using 'particle serial monitor --follow'
SerialLogHandler logHandler(LOG_LEVEL_INFO,
{
{"app", LOG_LEVEL_ALL}, // Logging level for non-application messages
{"wiring", LOG_LEVEL_NONE} // stop ERROR: recv error 128 on wiringß
});
void scanner()
{
byte error, address; // variable for error and I2C address
int nDevices;
Wire.begin();
Log.info("Scanning");
nDevices = 0;
for (address = 1; address < 127; address++)
delay(10);
{
Wire.beginTransmission(address);
error = Wire.endTransmission();
if (error == 0)
{
Log.info("I2C device found at address 0x");
if (address < 16)
Log.info("0");
Log.info("Found I2C 0x" + String(address, HEX));
nDevices++;
}
else if (error == 4)
{
Log.info("Unknown error at address 0x");
if (address < 16)
Log.info("0");
Log.info("Found I2C 0x" + String(address, HEX));
}
}
if (nDevices == 0)
Log.info("No I2C devices found");
else
Log.info("done");
delay(5000);
}
// setup() runs once, when the device is first turned on
void setup()
{
// Put initialization like pinMode and begin functions here
// Serial.begin(9600);
waitUntil(Particle.connected);
scanner();
// Initialize the TCS34725
Log.info("Checking TCS34725...");
if (tcs.begin())
{
Serial.println("Found sensor");
}
else
{
Serial.println("NO TCS34725 found ... check your connections");
while (1)
;
}
}
// loop() runs over and over again, as quickly as it can execute.
void loop()
{
// The core of your code will likely live here.
// Example: Publish event to cloud every 10 seconds. Uncomment the next 3 lines to try it!
// Log.info("Sending Hello World to the cloud!");
// Particle.publish("Hello world!");
// delay( 10 * 1000 ); // milliseconds and blocking - see docs for more info!
Log.info("loop");
delay(10000);
}