delay.h not found when using the BH1750 library

7 years 10 months ago #3350 by Jansen
Hello,

I am trying to get my BH1750 light sensor to work with my esp8266 board. When I build I get the message C:\Program Files (x86)\Arduino\libraries\BH1750\BH1750.cpp:15:24: fatal error: util/delay.h: No such file or directory.

The library (and the sensor) works fine when I use my arduino nano so the library itself is OK.

I installed the esp8266 addon once via the boards manager and once via github. In both cases I get this error. I have no idea how to fix this problem. Can someone please help me?

Please Log in or Create an account to join the conversation.

7 years 10 months ago - 7 years 10 months ago #3376 by edautz
I got also this error.

I solved using the library of Sermus:

github.com/Sermus/ESP8266_ArduinoIDE/tre.../libraries/BH1750FVI instead of the default library.

But the syntax of the examples makes no sense:

After experimenting and studing the library source I discovered the right syntax:

In the start of the sketch:

BH1750FVI LightSensor(0x23); //Default I2C adres when connecting the addr pin to ground.

void setup():

LightSensor.begin();
LightSensor.setMode(BH1750_Continuous_H_resolution_Mode); //or another mode if you like.

void loop():
Lux = LightSensor.getLightIntensity();// Get Lux value

This works stable and fine in my setup using NodeMCU V3 and ESP8266 board manager 2.0.0.

Please Log in or Create an account to join the conversation.

Time to create page: 0.135 seconds

Forum latest

  • No posts to display.