GithubHelp home page GithubHelp logo

Comments (4)

claws avatar claws commented on August 15, 2024
  1. The formatting of the code in the issue report makes it a little hard for me to read. However, it looks like you have moved the code that typically resides in the loop function up into the setup function, leaving the loop function empty. Was this intentional?
  2. Have you confirmed that your devices works fine with one of the example scripts (i.e. without the ESP deepSleep addition)?
  3. Does the problem only appear once you add the deepSleep line?

from bh1750.

ahostn avatar ahostn commented on August 15, 2024

Hello. I'm pretty sure now that I have a hardware problem, your code is good.
If I connect the GY-30 sensor, ESP8266 doesn't even connect to WiFi even if I use external power for the sensor. If I attach the sensor (+3.3V line) after wifi is connected, it works fine... until reset/sleep. i2c bus is not stuck, so it must be something with the sensor.
Even your example code now works only if I connect power to the sensor after booting up, but it worked for the first time when I tried it.. :)

from bh1750.

pahanadithya avatar pahanadithya commented on August 15, 2024

#include <BH1750.h>
#include <Wire.h>

BH1750 lightMeter;

void setup() {
Serial.begin(9600);

Wire.begin();

lightMeter.begin();

Serial.println(F("BH1750 Test begin"));
}

void loop() {
float lux = lightMeter.readLightLevel();
Serial.print("Light: ");
Serial.print(lux);
Serial.println(" lx");
delay(1000);
}

This is my code, I always get an error as "[BH1750] Device is not configured!
Light: -2.00 lx" , how can i fixed that error. I can't ger proper output.
Uploading Screenshot (58).png…

from bh1750.

ahostn avatar ahostn commented on August 15, 2024

If you’re using deepSleep, you should move all your code in setup block, not main loop.

from bh1750.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.