Not getting correct value from BH1750
-
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);
}
-
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
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login