summaryrefslogtreecommitdiff
path: root/esp
diff options
context:
space:
mode:
Diffstat (limited to 'esp')
-rw-r--r--esp/BH1750.ino21
1 files changed, 21 insertions, 0 deletions
diff --git a/esp/BH1750.ino b/esp/BH1750.ino
index e69de29..9d4f9c9 100644
--- a/esp/BH1750.ino
+++ b/esp/BH1750.ino
@@ -0,0 +1,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);
+} \ No newline at end of file