Configuring the ISL29125 RGB sensor.

This code snippet:

if (RGB_sensor.init())

{

Serial.println(“Sensor Initialization Successful\n\r”);

}

RGB_sensor.config(CFG1_MODE_RGB); // reads all 3 sensors.

//RGB_sensor.config(CFG1_10KLUX);

//RGB_sensor.config(CFG1_16BIT);

won’t compile with any of these references to the config() function uncommented.

no matching function for call to ‘SFE_ISL29125::config(int)’

The sketch works fine without these references. In the “interrupts” example code, there are examples of using this function. Can you explain what’s the problem here?

Hello,

Are you using exactly the sample code or modifying it? Is there any chance that the library is conflicting with any other library that you’re using?

I don’t think there’s any problem with the library. What would be helpful is if you could show me how to alter the sensor configuration in this code, after the sensor is successfully initialized. I don’t know that it’s actualliy necessary to change anything about the default configuration, but it seems like I should be able to use config() to do that as required.

/*ISL29125_OLED.ino

A basic test sketch is available in the Sparkfun library.

See ISL29125Test.ino for my version.

Adds IZOKEE 0.96" I2C OLED display for output.

*/

#include <Wire.h>

#include “SparkFunISL29125.h”

SFE_ISL29125 RGB_sensor;

#include “U8x8lib.h”

U8X8_SSD1306_128X64_NONAME_HW_I2C u8x8(U8X8_PIN_NONE);

unsigned int red,green,blue,total;

float Fred,Fgreen,Fblue;

const long int DelayTime=2000L;

void setup(){

Serial.begin(9600); u8x8.begin();

u8x8.setFont(u8x8_font_chroma48medium8_r);

if (RGB_sensor.init()) {

Serial.println(“Sensor Initialization Successful\n\r”);

}

}

void loop() {

red=RGB_sensor.readRed(); green=RGB_sensor.readGreen();

blue=RGB_sensor.readBlue(); total=red+blue+green;

Fred=(float)red/total; Fgreen=(float)green/total;

Fblue=(float)blue/total;

Serial.print("Red: "); Serial.println(red);

Serial.print("Green: "); Serial.println(green);

Serial.print("Blue: "); Serial.println(blue);

Serial.print("Fred: "); Serial.println(Fred,4);

Serial.print("Fgreen: "); Serial.println(Fgreen,4);

Serial.print("Fblue: "); Serial.println(Fblue,4);

u8x8.setCursor(0,1);

u8x8.print(" Red: "); u8x8.println(red);

u8x8.print("Green: "); u8x8.println(green);

u8x8.print(" Blue: "); u8x8.println(blue);

u8x8.print(" Fred: "); u8x8.println(Fred,4);

u8x8.print("Fgreen: "); u8x8.println(Fgreen,4);

u8x8.print(" Fblue: "); u8x8.println(Fblue,4);

delay(DelayTime);

u8x8.clearDisplay();

}

Well, OK. This code compiles, although I don’t know why! A remaining question I have is about the IR_ADJUST_ setting. If I want to use this to look at surface colors outdoors, under sunlight, does IR_ADJUST_HIGH do the best job of blocking infrared radiation? The data sheet wasn’t very helpful about answering this question. Can anyone help?

void setup(){

Serial.begin(9600); u8x8.begin();

u8x8.setFont(u8x8_font_chroma48medium8_r);

if (RGB_sensor.init()) {

Serial.println(“Sensor Initialization Successful\n\r”);

}

RGB_sensor.config(CFG1_MODE_RGB | CFG1_10KLUX, CFG2_IR_ADJUST_HIGH, CFG3_R_INT | CFG3_NO_INT);

}