KRITSADA

POP-X2 Test BH1750 Lux Sensor Light meter

Apr 9th, 2018
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. // Test Module BH1750 with POP-X2 Board
  2. // Libarry from https://github.com/claws/BH1750
  3. #include <popx2.h>
  4. #include <BH1750.h>
  5. long L;
  6. BH1750 Lux;
  7. void setup(){
  8.   Wire.begin();
  9.   Lux.begin();
  10.   setTextSize(2);glcdMode(3);
  11.   setTextColor(GLCD_YELLOW);glcd(0,0,"BH1750");
  12.   setTextColor(GLCD_SKY);   glcd(0,7,"Test");
  13.   glcdFillRect(0,64,80,64,GLCD_WHITE);
  14. }
  15. void loop() {
  16.   L = Lux.readLightLevel();
  17.   setTextColor(GLCD_GREEN); glcd(2,0,"Light");
  18.   setTextColor(GLCD_VIOLET); glcd(2,6,"%l lx   ",L);
  19.   delay(100);
  20. }
Advertisement
Add Comment
Please, Sign In to add comment