Home Arduino Can I exploit a TCS34725 colour sensor with a LilyPad?

Can I exploit a TCS34725 colour sensor with a LilyPad?

0
Can I exploit a TCS34725 colour sensor with a LilyPad?

[ad_1]

I’ve been attempting to get a TCS34725 colour sensor working with a LilyPad Arduino USB – ATmega32U4 board, however with no success. I’m questioning if it doable?

I’ve been utilizing the next sketch to attempt to get a studying however nothing seems within the monitor:

#embrace <Wire.h>
#embrace "Adafruit_TCS34725.h"

/* Instance code for the Adafruit TCS34725 breakout library */

/* Join SCL    to analog 5
   Join SDA    to analog 4
   Join VDD    to three.3V DC
   Join GROUND to widespread floor */

/* Initialise with default values (int time = 2.4ms, acquire = 1x) */
// Adafruit_TCS34725 tcs = Adafruit_TCS34725();

/* Initialise with particular int time and acquire values */
Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_700MS, TCS34725_GAIN_1X);

void setup(void) {
  Serial.start(9600);

  if (tcs.start()) {
    Serial.println("Discovered sensor");
  } else {
    Serial.println("No TCS34725 discovered ... verify your connections");
    whereas (1);
  }

  // Now we're able 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);
  colorTemp = tcs.calculateColorTemperature_dn40(r, g, b, c);
  lux = tcs.calculateLux(r, g, b);

  Serial.print("Coloration Temp: "); Serial.print(colorTemp, DEC); Serial.print(" Okay - ");
  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(" ");
}

[ad_2]

LEAVE A REPLY

Please enter your comment!
Please enter your name here