AS7341 Spectral Color Sensor

Hello,

I have an ELEGOO UNO R3, what is an ARDUINO UNO R3, right?
and an AS7341 Spectral Color Sensor (https://www.waveshare.com/as7341-spectral-color-sensor.htm).

Here my Hardware Connection (follow vendor instructions)

I follow all the software instructions (install Arduino, library and follow the examples) and contact the vendor service but I still with the same error (see image below).

Do you think it is a code error, incompatible parts, or a problem with the sensor?

Thanks for your help in advance.

Please post the code, using code tags ("</>" button) and error messages using quotes (not as screenshots).

Thank you, you are right. that will make the question clearer.

The AS7341 is an 11-channel spectrometer for spectral identification and color matching applications.

The library is from wiki link posted for the vendor: https://www.waveshare.com/wiki/AS7341_Spectral_Color_Sensor
Library and examples link: https://www.waveshare.com/w/upload/b/b3/AS7341_Spectral_Color_Sensor_code.7z

The code to get data from each channel :

include <Debug.h>

#include "DEV_Config.h"
#include "Waveshare_AS7341.h"

void setup() {
DEV_ModuleInit();
Serial.print("IIC ready! Now start initializing AS7341!\r\n");
AS7341_Init(eSpm);
AS7341_ATIME_config(100);
AS7341_ASTEP_config(999);
AS7341_AGAIN_config(6);
//AS7341_EnableLED(true);// LED ON or OFF
}

void loop() {

  sModeOneData_t data1;
  sModeTwoData_t data2;
  AS7341_startMeasure(eF1F4ClearNIR);
  data1 = AS7341_ReadSpectralDataOne();
  Serial.print("channel1(405-425nm):");
  Serial.println(data1.channel1);
  Serial.print("channel2(435-455nm):");
  Serial.println(data1.channel2);
  Serial.print("channel3(470-490nm):");
  Serial.println(data1.channel3);
  Serial.print("channel4(505-525nm):");   
  Serial.println(data1.channel4);
  AS7341_startMeasure(eF5F8ClearNIR);
  data2 =AS7341_ReadSpectralDataTwo();
  Serial.print("channel5(545-565nm):");
  Serial.println(data2.channel5);
  Serial.print("channel6(580-600nm):");
  Serial.println(data2.channel6);
  Serial.print("channel7(620-640nm):");
  Serial.println(data2.channel7);
  Serial.print("channel8(670-690nm):");
  Serial.println(data2.channel8);
  Serial.print("Clear:");
  Serial.println(data2.CLEAR);
  Serial.print("NIR:");
  Serial.println(data2.NIR);
  Serial.print("--------------------------\r\n"); 
  DEV_Delay_ms(500);  
  
  //AS7341_ControlLed(10);//Adjust the brightness of the LED lamp 
}

And the error is:
"
C:\Program Files (x86)\Arduino\libraries\Waveshare_AS7341\src\DEV_Config.cpp: In function 'int I2C_Read_Byte(uint8_t)':
C:\Program Files (x86)\Arduino\libraries\Waveshare_AS7341\src\DEV_Config.cpp:104:33: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
Wire.requestFrom(I2C_ADDR, 1);
^
In file included from C:\Program Files (x86)\Arduino\libraries\Waveshare_AS7341\src\DEV_Config.h:11:0,
from C:\Program Files (x86)\Arduino\libraries\Waveshare_AS7341\src\DEV_Config.cpp:12:
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src/Wire.h:68:13: note: candidate 1: uint8_t TwoWire::requestFrom(int, int)
uint8_t requestFrom(int, int);
^~~~~~~~~~~
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src/Wire.h:65:13: note: candidate 2: uint8_t TwoWire::requestFrom(uint8_t, uint8_t)
uint8_t requestFrom(uint8_t, uint8_t);
^~~~~~~~~~~
C:\Program Files (x86)\Arduino\libraries\Waveshare_AS7341\src\DEV_Config.cpp: In function 'int I2C_Read_Word(uint8_t)':
C:\Program Files (x86)\Arduino\libraries\Waveshare_AS7341\src\DEV_Config.cpp:120:33: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
Wire.requestFrom(I2C_ADDR, 2);
^
In file included from C:\Program Files (x86)\Arduino\libraries\Waveshare_AS7341\src\DEV_Config.h:11:0,
from C:\Program Files (x86)\Arduino\libraries\Waveshare_AS7341\src\DEV_Config.cpp:12:
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src/Wire.h:68:13: note: candidate 1: uint8_t TwoWire::requestFrom(int, int)
uint8_t requestFrom(int, int);
^~~~~~~~~~~
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src/Wire.h:65:13: note: candidate 2: uint8_t TwoWire::requestFrom(uint8_t, uint8_t)
uint8_t requestFrom(uint8_t, uint8_t);
^~~~~~~~~~~
"

That did not work. Please re-edit. Also state where and how you obtained the libraries (post links).

See the "How to get the best out of the forum" post for instructions.

For example, to use code tags, select the code, then press the "</>" editor button.

Hi,

I downloaded the library and examples from here(https://www.waveshare.com/wiki/AS7341_Spectral_Color_Sensor#Resources) - library is the 'demo' link under 'Rescources', installed it for my arduino v1.8.12 IDE.

Tried to compile the AS7341_Getdata.ino example sketch for UNO board and it compiled with no issue.

Note that those look like warnings... not actual errors!

so you might be OK since the code did seem to compiles successfully on your side.

hope that helps...

Hello,

I made work the sensor. I changed the Arduino version for the Arduino 1.8.12 and new cables.

Thanks for your help.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.