Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on compile #7

Open
billbill100 opened this issue Feb 5, 2023 · 1 comment
Open

Error on compile #7

billbill100 opened this issue Feb 5, 2023 · 1 comment

Comments

@billbill100
Copy link

billbill100 commented Feb 5, 2023

Hi,
Using UDE 2.0.3 and library BH1750 by Christopher Laws, version 1.3.0

In file included from C:\Users\Nigel\Documents\Arduino\lightmeter-master\lightmeter-master\src\lightmeter\lightmeter.ino:76:0:
C:\Users\Nigel\Documents\Arduino\lightmeter-master\lightmeter-master\src\lightmeter\lightmeter.h: In function 'float getLux()':
C:\Users\Nigel\Documents\Arduino\lightmeter-master\lightmeter-master\src\lightmeter\lightmeter.h:52:49: error: no matching function for call to 'BH1750::readLightLevel(bool)'
uint16_t lux = lightMeter.readLightLevel(false);
^
In file included from C:\Users\Nigel\Documents\Arduino\lightmeter-master\lightmeter-master\src\lightmeter\lightmeter.ino:7:0:
c:\Users\Nigel\Documents\Arduino\libraries\BH1750-master\src/BH1750.h:70:9: note: candidate: float BH1750::readLightLevel()
float readLightLevel();
^~~~~~~~~~~~~~
c:\Users\Nigel\Documents\Arduino\libraries\BH1750-master\src/BH1750.h:70:9: note: candidate expects 0 arguments, 1 provided

exit status 1

Compilation error: no matching function for call to 'BH1750::readLightLevel(bool)'

Seems to be line 52
uint16_t lux = lightMeter.readLightLevel(false);

Now, if I remove the word 'false' so the line is as below, the code compiles without error

uint16_t lux = lightMeter.readLightLevel();

I have no idea what the 'false' does in the code, I wonder if it is there to wait for the read cycle from the sensor is complete?

Looking at the advanced example file, (pasted below), I'm wondering if the library file has been updated so one now uses something like
'if (lightMeter.measurementReady(true))' instead of the 'false' argument?

Help/advise appreciated.
thanks.

void loop() {
// we use here the maxWait option due fail save
if (lightMeter.measurementReady(true)) {
float lux = lightMeter.readLightLevel();
Serial.print(F("Light: "));
Serial.print(lux);
Serial.println(F(" lx"));

if (lux < 0) {
  Serial.println(F("Error condition detected"));
@laptopsftw
Copy link

i had the same issue today, i downgraded the library down to 1.1.4. turns out it was deprecated since version 1.2.0. it compiled successfully

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants