UPDATE 3
So far, I applied the option or removing and replacing teh Delay() with a timer loop. But I am getting 0 readings. It looks possibly a problem with the way the variable have been set up. Here is the updated code. BUT only returns 0 readings.
Here is the SKETCH
#include <Wire.h>
#include "Adafruit_AS726x.h"
//create the object
Adafruit_AS726x ams;
//buffer para leer valores en bruto
uint16_t sensorValues[AS726x_NUM_CHANNELS];
//buffer para guardar los valores calibrados( no esta siendo utilizado en este codigo)
//float calibratedValues[AS726x_NUM_CHANNELS];
void setup() {
Serial.begin(115200);
while (!Serial)
;
// inicializa el pin digital LED_BUILTIN como un output.
pinMode(LED_BUILTIN, OUTPUT);
//inicia y permite la comunicacion con el sensor
if (!ams.begin()) {
Serial.println("could not connect to sensor! Please check your wiring.");
while (1)
;
}
}
void loop() {
//lee la temperatura del sensor
//uint8_t temp = ams.readTemperature();
//ams.drvOn(); // descomentar esto si quieres usar el led del sensor para hacer medidas
ams.startMeasurement(); //begin a measurement
//permite que el sensor lea la data cuando este disponible
bool rdy = false;
while (!rdy) {
delay(5);
rdy = ams.dataReady();
}
//ams.drvOff(); //descomentar esto si quieres usar el led del sensor para hacer medidas
//lee los valores!
ams.readRawValues(sensorValues);
//ams.readCalibratedValues(calibratedValues);
//Serial.print("{");
//Serial.print("Temp: ");
//Serial.print(temp);
//Serial.print(",");
//Serial.print(" Violet: ");
Serial.print(sensorValues[AS726x_VIOLET]);
Serial.print(",");
//Serial.print(" Blue: ");
Serial.print(sensorValues[AS726x_BLUE]);
Serial.print(",");
//Serial.print(" Green: ");
Serial.print(sensorValues[AS726x_GREEN]);
Serial.print(",");
//Serial.print(" Yellow: ");
Serial.print(sensorValues[AS726x_YELLOW]);
Serial.print(",");
//Serial.print(" Orange: ");
Serial.print(sensorValues[AS726x_ORANGE]);
Serial.print(",");
//Serial.print(" Red: ");
Serial.print(sensorValues[AS726x_RED]);
//Serial.print("}");
Serial.println();
;
}