0

Wire library problem w/ TCS34725 RGB Color Sensor
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Wire library problem w/ TCS34725 RGB Color Sensor

by jayzy on Wed May 15, 2019 2:16 pm

Hi-
I uploaded code for testing the TCS34725, but, it would not compile on my Arduino Uno R3, using the latest Arduino interface, citing a wire library issue. I can’t figure out how to make this source code, found online, compile and upload. The code and resultant error code are:

#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(" ");
}

Error:

/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.1/libraries/ Wire/Wire.cpp:38:2: error: #error Wire library is not supported on this board
#error Wire library is not supported on this board

jayzy
 
Posts: 1
Joined: Sat Nov 12, 2011 7:37 pm

Re: Wire library problem w/ TCS34725 RGB Color Sensor

by adafruit_support_bill on Wed May 15, 2019 2:27 pm

/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.1/libraries/ Wire/Wire.cpp:38:2: error:

You are compiling for an esp8266 board. Go to "Tools->Board" and select "UNO" as your board type.

adafruit_support_bill
 
Posts: 74030
Joined: Sat Feb 07, 2009 10:11 am

Please be positive and constructive with your questions and comments.