I'm building a project that involves a small robot traveling along a set path and doing various things, which require RGB to determine certain things that aren't relevant to my issue.
Over the weekend I messed around with a TCS34725 RGB sensor in order to get an understanding of how it works so that today I could build the chassis of the robot and integrate all the different sensors into my algorithm. Just before I started the build, I used the sensor to take RGB values of various different colored electrical tapes, so the code itself was working fine and it had a great connection to the arduino.
Fast forward 6 hours and the build is completed, I get everything wired up and plug the arduino back in. Suddenly it cannot detect the sensor. I check my connections multiple times, unplug extraneous sensors, dismantle the setup to what I had over the weekend, and nothing is working. I grab a spare sensor and wire it up just like I did when it was working, completely off the chassis. Still nothing. I grab a second arduino and test it with both sensors. Still nothing.
At this point I'm assuming it must have something to do with my code, but I haven't touched my code since I started the build, and when I did it was working perfectly. I deleted the library and re-installed it. Nothing. I made an entirely new project and copied the sample code I was working with just to make sure it worked over the weekend into this new project. Still nothing. At this point I'm at a loss. I don't understand how no matter what I do I can't get either of these two sensors to connect to the board. It's been working for 3 days for crying out loud! Does anyone have any idea why this might be happening?
The sample code I pulled from a website for testing (where before it instantly worked on the first try and now refuses to connect) is here:
#include <Wire.h>
#include "Adafruit_TCS34725.h"
/* Example code for the Adafruit TCS34725 breakout library */
/* Connect SCL to analog 5
Connect SDA to analog 4
Connect VDD to 3.3V DC
Connect GROUND to common ground */
/* Initialise with default values (int time = 2.4ms, gain = 1x) */
// Adafruit_TCS34725 tcs = Adafruit_TCS34725();
/* Initialise with specific int time and gain values */
Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_700MS, TCS34725_GAIN_1X);
void setup(void) {
Serial.begin(9600);
if (tcs.begin()) {
Serial.println("Found sensor");
} else {
Serial.println("No TCS34725 found ... check your connections");
while (1);
}
// Now we're ready to get readings!
}
void loop(void) {
uint16_t r, g, b, c, colorTemp, lux;
tcs.getRawData(&r, &g, &b, &c);
colorTemp = tcs.calculateColorTemperature(r, g, b);
lux = tcs.calculateLux(r, g, b);
Serial.print("Color Temp: "); Serial.print(colorTemp, DEC); Serial.print(" K - ");
Serial.print("Lux: "); Serial.print(lux, DEC); Serial.print(" - ");
Serial.print("R: "); Serial.print(r, DEC); Serial.print(" ");
Serial.print("G: "); Serial.print(g, DEC); Serial.print(" ");
Serial.print("B: "); Serial.print(b, DEC); Serial.print(" ");
Serial.print("C: "); Serial.print(c, DEC); Serial.print(" ");
Serial.println(" ");
}
The board I'm using is an Arduino Uno. I will say that the LED on the sensor itself is bright as can be, so at the very least the power and ground connections work perfectly. For some reason it's just not making the connection anymore, and I can't figure out why.
The only thing I can think of is that, just after I had finished hooking everything up, my code got a "GetFileAttributesEx" error. It was seemingly fixed by closing and reopening the IDE, but maybe that screwed something up more permanently?
Any help at all would be greatly appreciated.