Ambient Light Sensor - VEML6030 compiler errors

I bought this sensor:

SparkFun Ambient Light Sensor - VEML6030 (Qwiic) SEN-15436

but getting the following compiler errors: I tried it with both a win7 and win10 machine using a UNO board

thanks

In file included from C:\Users\xxxxxxx\Documents\Arduino\libraries\SparkFun_Ambient_Light_Sensor_Arduino_Library\src\SparkFun_VEML6030_Ambient_Light_Sensor.h:4:0,

from C:\Users\xxxxxxx\Documents\Arduino\libraries\SparkFun_Ambient_Light_Sensor_Arduino_Library\src\SparkFun_VEML6030_Ambient_Light_Sensor.cpp:11:

C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src/Wire.h: In member function ‘uint16_t SparkFun_Ambient_Light::_readRegister(uint8_t)’:

C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src/Wire.h:64: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:61:13: note: candidate 2: uint8_t TwoWire::requestFrom(uint8_t, uint8_t)

uint8_t requestFrom(uint8_t, uint8_t);

^

Sketch uses 7728 bytes (3%) of program storage space. Maximum is 253952 bytes.

Global variables use 651 bytes (7%) of dynamic memory, leaving 7541 bytes for local variables. Maximum is 8192 bytes.

Hi jimk123,

I’m not able to recreate that error on my computer here so we’ll need a bit more information about your setup here. What version of Arduino are you running (eg. version number as well as install type: Windows app, zip install, executable install)? How did you install the SparkFun Ambient Light Sensor library? Does the error persist regardless of which example you are using from the library or is it limited to a specific example? If it’s a single example, which one is causing the compile error?

win 10, IDE 1.8.5. I installed the library from the library manager

I was using the first example, Example1_Read_Ambient_Basics.ino

thanks

I was having a similar problem with compiler errors installing the library from the IDE so I manually deleted the VEML library folder, download the zip from github, unzipped it , and still getting the compiler errors (win10, ide 1.8.5) but I went ahead down uploaded it and the code runs but would like to understand why I am getting so many compiler errors, thanks

C:\Users\Jim\Documents\Arduino\libraries\SparkFun_Ambient_Light_Sensor_Arduino_Library\src\SparkFun_VEML6030_Ambient_Light_Sensor.cpp: In member function ‘uint16_t SparkFun_Ambient_Light::_readRegister(uint8_t)’:

C:\Users\Jim\Documents\Arduino\libraries\SparkFun_Ambient_Light_Sensor_Arduino_Library\src\SparkFun_VEML6030_Ambient_Light_Sensor.cpp:552:36: 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:

_i2cPort->requestFrom(_address, 2); // Two reads for 16 bit registers

^

In file included from C:\Users\Jim\Documents\Arduino\libraries\SparkFun_Ambient_Light_Sensor_Arduino_Library\src\SparkFun_VEML6030_Ambient_Light_Sensor.h:4:0,

from C:\Users\Jim\Documents\Arduino\libraries\SparkFun_Ambient_Light_Sensor_Arduino_Library\src\SparkFun_VEML6030_Ambient_Light_Sensor.cpp:11:

C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src/Wire.h:64: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:61:13: note: candidate 2: uint8_t TwoWire::requestFrom(uint8_t, uint8_t)

uint8_t requestFrom(uint8_t, uint8_t);

^

Sketch uses 7414 bytes (22%) of program storage space. Maximum is 32256 bytes.

Global variables use 655 bytes (31%) of dynamic memory, leaving 1393 bytes for local variables. Maximum is 2048 bytes.

in the serial window I see:

Ready to sense some light!

Reading settings…

Gain: 0.125 Integration Time: 100

Ambient Light Reading: 5 Lux

Ambient Light Reading: 5 Lux

was doing some more research and I think I found the problem , if you edit SparkFun_VEML6030_Ambient_Light_Sensor.cpp around line 552

the wire.requestfrom call does not specify a datatype. if you prefix ‘2’ with the datatype of byte or uint8_t it will compile clean.

example:

_i2cPort->requestFrom(_address, byte(2)); // Two reads for 16 bit registers

I think the reason you did not get the warnings is in the arduino IDE under File, Preferences , compiler warnings = none ? by doing that it would suppress the warnings. Mine was set the default.

Perhaps the programmer who coded SparkFun_VEML6030_Ambient_Light_Sensor.cpp update line 552 and specify a datatype ? It looks like requestfrom takes several options and if the datatype of the second parameter is not specified the compiler does not know which option to use and throws a warning.

thanks

Ah, that explains why I could not replicate your error. I checked my preferences and did not have that set to print anything. I now am seeing the same compiler errors. It looks like the code should run okay without it but we’ll look into that line in the .cpp file and see if it needs adjusting.

Hi again,

I have a quick update on the compile error here. An issue has been filed on the [GitHub Repository for this board and the library should be fixed in the next couple of days.

Thanks again for looking into this and identifying the source. Let us know if you run into any other issues with this or another of our products, tutorials or example code or if you have any questions about them and we would be happy to help.](Ambiguity in requestFrom · Issue #1 · sparkfun/SparkFun_Ambient_Sensor_VEML6030 · GitHub)

Thanks for all your help Mark !

Thanks @jimk123 for bringing this issue to the forums. The ambiguity warning has been fixed in the latest [release of the library’s Github Repo. As you mentioned, the second argument needed to be cast to a specific type so as to avoid ambiguity and if you’re interested, you can see the change in the latest commit [here.](Casts second argument to requestFrom as a uint8_t to avoid compile er… · sparkfun/SparkFun_Ambient_Light_Sensor_Arduino_Library@1daebe2 · GitHub)](Releases · sparkfun/SparkFun_Ambient_Light_Sensor_Arduino_Library · GitHub)