BH1750 Ambient Light Sensor

The BH1750 is a 16-bit ambient light sensor that communicates via I2C protocol. It outputs luminosity measurements in lux (SI-derived unit of illuminance). It can measure a minimum of 1 lux and a maximum of 65535 lux.


0 ₪

الناشر: متجر القطع الالكترونية

القسم: مستشعرات - سينسور

تاريخ النشر: 2022-10-12




connect to ESP32



cct





Installing the BH1750 Library



code
نسخ
اقتباس
عرض
تنزيل
	
								
/* Example of BH1750 library usage. This example initialises the BH1750 object using the default high resolution continuous mode and then makes a light level reading every second. */ #include <Wire.h> #include <BH1750.h> BH1750 lightMeter; void setup(){ Serial.begin(9600); // Initialize the I2C bus (BH1750 library doesn't do this automatically) Wire.begin(); // On esp8266 you can select SCL and SDA pins using Wire.begin(D4, D3); // For Wemos / Lolin D1 Mini Pro and the Ambient Light shield use Wire.begin(D2, D1); lightMeter.begin(); Serial.println(F("BH1750 Test begin")); } void loop() { float lux = lightMeter.readLightLevel(); Serial.print("Light: "); Serial.print(lux); Serial.println(" lx"); delay(1000); }


result



سلة المشتريات افراغ السلة