LCD + BH1750 Bar Graph


This sketch requires LcdBarGraph and BH1750 library.

You can download the library here

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

BH1750 lightMeter;

byte lcdNumCols = 16; // — number of columns in the LCD
byte sensorPin = 2; // — value for this example

LiquidCrystal lcd(8,9,10,11,12,13); // — creating LCD instance
LcdBarGraph lbg(&lcd, lcdNumCols);// — creating a 4 char wide baraph in the end of second column (column 1)

void setup(){
// — initializing the LCD
lcd.begin(2, lcdNumCols);
// — do some delay: some time I’ve got broken visualization


void loop()
uint16_t lux = lightMeter.readLightLevel();
// — draw bar graph from the analog value readed
lbg.drawValue((lux), 30);
// — do some delay: frequent draw may cause broken visualization

This entry was posted in Arduino Project. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s