Go Down

Topic: Feather serial monitor not working with tcs (Read 201 times) previous topic - next topic

yeehaaw

Jun 03, 2019, 06:53 pm Last Edit: Jun 03, 2019, 06:56 pm by yeehaaw
Good evening. I'm trying to send through Lora (https://learn.adafruit.com/adafruit-feather-m0-radio-with-lora-radio-module/overview) the values obtained with the RGB sensor (TCS34725). I am using this simple code for testing.
Code: [Select]
#include <Wire.h>
#include "Adafruit_TCS34725.h"


#define commonAnode true

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


Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_50MS, TCS34725_GAIN_4X);

void setup() {
  Serial.begin(9600);
  //Serial.println("Color View Test!");

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

 
  // 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;

    if (commonAnode) {
      gammatable[i] = 255 - x;
    } else {
      gammatable[i] = x;
    }
    //Serial.println(gammatable[i]);
  }
}


void loop() {
  float red, green, blue;
 
  tcs.setInterrupt(false);  // turn on LED

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

  tcs.getRGB(&red, &green, &blue);
 
  tcs.setInterrupt(true);  // turn off LED

  Serial.println(int(red));
   Serial.println(int(green));
   Serial.println(int(blue));

  Serial.print("\n");

}

It works perfectly with my  Arduino UNO but when I try to use the same with the Feather (everything is OK) it shows a blank Serial Monitor. If i just upload a Serial.print("hello") it will work, but not with the tcs. I am going crazy.
Thanks

Meric

#1
Jun 04, 2019, 11:19 am Last Edit: Jun 04, 2019, 02:00 pm by Meric
Hi yeehaaw,
Your sensor talking trough an I2C protocol.
=> I assume that the pins used to build up the I2C are those used for the LoRa emitter.
Have a look here for further information on a similar board.

Enjoy'
Méric.

Go Up