Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. Not getting correct value from BH1750

Not getting correct value from BH1750

Scheduled Pinned Locked Moved Troubleshooting
3 Posts 2 Posters 875 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • iotearoaI Offline
    iotearoaI Offline
    iotearoa
    wrote on last edited by iotearoa
    #1

    I managed to get all three of these working:

    • NRFL as client
    • OLED SPI 128x64
    • BM1750

    My C programming is a bit rusty I hope someone could help me. I'm planning to use the OLED screen as a "serial console" rather than plugging in a USB all the time. However, when I use the readLightLeve() from BH1750 libraries, on my SPI I'm getting gibberish characters. I suspect because the u8g.print() anticipates a char

    Any ideas how do I fix this? Here's the draw() function I used within the loop

    void draw(void) {
    uint16_t lux;
    lux = lightMeter.readLightLevel();
    u8g.drawBitmapP( 76, 5, 6, 50, logo);
    u8g.setFont(u8g_font_unifont);
    u8g.drawStr(0, 30, "Lux: ");
    u8g.setPrintPos(44, 30);
    u8g.print( lux , 0);
    }

    0_1483416685920__MG_0084_small.JPG

    1 Reply Last reply
    0
    • Nca78N Offline
      Nca78N Offline
      Nca78
      Hardware Contributor
      wrote on last edited by
      #2

      Hello, a search on Google with keywords "u8g print integer" or "u8g print variable" will give answers to your questions :)

      For example :
      http://arduino.stackexchange.com/questions/17766/how-to-display-variables-on-0-96-oled-with-u8glib-library

      1 Reply Last reply
      1
      • iotearoaI Offline
        iotearoaI Offline
        iotearoa
        wrote on last edited by
        #3

        Thanks @Nca78 ! That worked!

        1 Reply Last reply
        1
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        21

        Online

        11.7k

        Users

        11.2k

        Topics

        113.1k

        Posts


        Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • MySensors
        • OpenHardware.io
        • Categories
        • Recent
        • Tags
        • Popular