Adafruit TC34725 error

Hi Little Bird Forum,

We are trying to test the adafruit TC34725 colour sensor using the serial monitor - but have not been successful.
We already have the TC34725 library installed to Arduino IDE and have wired them up correctly - however - still not successful

Anybody willing to share the code to test this sensor using the serial monitor please?

Thank you

Hi prunella, so that we can narrow down the issue, could you please post:

  • The error messages you are getting on the Arduino IDE
  • The code you are using
  • A photo of the circuit diagram



The code we used is the following:

#include <Wire.h>
#include “Adafruit_TCS34725.h”
#include <Adafruit_NeoPixel.h>

// Parameter 1 = number of pixels in strip
// Parameter 2 = pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
// NEO_RGB Pixels are wired for RGB bitstream
// NEO_GRB Pixels are wired for GRB bitstream
// NEO_KHZ400 400 KHz bitstream (e.g. FLORA pixels)
// NEO_KHZ800 800 KHz bitstream (e.g. High Density LED strip)
Adafruit_NeoPixel strip = Adafruit_NeoPixel(12, 6, NEO_GRB + NEO_KHZ800);

// our RGB -> eye-recognized gamma color
byte gammatable[256];

Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_50MS, TCS34725_GAIN_4X);

void setup() {
Serial.println(“Color View Test!”);

strip.begin();; // Initialize all pixels to ‘off’

if (tcs.begin()) {
Serial.println(“Found sensor”);
} else {
Serial.println(“No TCS34725 found … check your connections”);
while (1); // halt!

// thanks PhilB for this gamma table!
// it helps convert RGB colors to what humans see
for (int i=0; i<256; i++) {
float x = i;
x /= 255;
x = pow(x, 2.5);
x *= 255;

gammatable[i] = x;      


for (int i=0; i<3; i++){ //this sequence flashes the first pixel three times as a countdown to the color reading.
strip.setPixelColor (0, strip.Color(188, 188, 188)); //white, but dimmer-- 255 for all three values makes it blinding!;
strip.setPixelColor (0, strip.Color(0, 0, 0));;

uint16_t clear, red, green, blue;

tcs.setInterrupt(false); // turn on LED

delay(60); // takes 50ms to read

tcs.getRawData(&red, &green, &blue, &clear);

tcs.setInterrupt(true); // turn off LED

Serial.print(“C:\t”); Serial.print(clear);
Serial.print("\tR:\t"); Serial.print(red);
Serial.print("\tG:\t"); Serial.print(green);
Serial.print("\tB:\t"); Serial.print(blue);

// Figure out some basic hex code for visualization
uint32_t sum = red;
sum += green;
sum += blue;
//sum += clear; // clear contains RGB already so no need to re-add it

float r, g, b;
r = red; r /= sum;
g = green; g /= sum;
b = blue; b /= sum;
r *= 256; g *= 256; b *= 256;
Serial.print((int)r, HEX); Serial.print((int)g, HEX); Serial.print((int)b, HEX);

Serial.print((int)r ); Serial.print(" “); Serial.print((int)g);Serial.print(” "); Serial.println((int)b );
colorWipe(strip.Color(gammatable[(int)r], gammatable[(int)g], gammatable[(int)b]), 0);

// Fill the dots one after the other with a color
void colorWipe(uint32_t c, uint8_t wait) {
for(uint16_t i=0; i<strip.numPixels(); i++) {
strip.setPixelColor(i, c);;

void loop() {

//loop is empty because it only takes the color reading once on power up! Turn the scarf off and on again to change the color.


The error code:
Used: /Users/saiya78/Documents/Arduino/libraries/Adafruit_NeoPixel
exit status 1
‘Serial’ was not declared in this scope

Guess you may need an include of “Arduino.h” in order to define Serial.

My mistake. The reason for the “Serial” not being declared is that the circuit board on the left is an Adafruit Gemma V2 which does not have a serial port capability. PDF.

Does it mean we cannot use GEMMA V2 at all? we must use FLORA instead?

Is there any possibility to alter parts of the code so we can use GEMMA V2 instead?

Thank you for your help :wink:

Hi prunella, what quozl said is correct. According to the documentation, “Gemma does not have a Serial port connection for debugging so the serial port monitor will not be able to send/receive data”.

If you need a platform with a small form factor and can be used for Serial port connection, check out the EagLED:

We also have a range of guides here for the EagLED:


Thanks Cherie,

Once we purchased this snapboard - can we still use the same code as mentioned above?

Hi Prunella,
The code should work with very minor changes…