summaryrefslogtreecommitdiff
path: root/esp/BH1750.ino
blob: 9d4f9c9fb30584bb800bc892f34405ded3df14c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <Wire.h>
#include <BH1750.h>

BH1750 lightMeter;

void setup(){
  Serial.begin(115200);
  Wire.begin(21, 22);
  lightMeter.begin();
  Serial.println("Teste sensor luminosidade");
}
void loop(){
  float lux =
  lightMeter.readLightLevel();

  Serial.print("Luminosidade: ");
  Serial.print(lux);
  Serial.println(" lux");

  delay(1000);
}