1 parent
d094ff3b74
commit
974d738212
1 file changed
+4
-7
+4
-7
@@ -64,16 +64,13 @@ void MeasureLightIntensity()
|
|||||||
float Wattsm2;
|
float Wattsm2;
|
||||||
|
|
||||||
// Check if reads failed and exit early (to try again).
|
// Check if reads failed and exit early (to try again).
|
||||||
Wire.beginTransmission(BH1750_i2c_addr);
|
|
||||||
Wire.requestFrom(BH1750_i2c_addr, 2);
|
Wire.requestFrom(BH1750_i2c_addr, 2);
|
||||||
while(Wire.available()) //
|
if(Wire.available() != 2) {
|
||||||
{
|
|
||||||
i <<=8;
|
|
||||||
i|= Wire.read();
|
|
||||||
}
|
|
||||||
if (Wire.endTransmission() != 0 ) {
|
|
||||||
trc(F("Failed to read from LightSensor BH1750!"));
|
trc(F("Failed to read from LightSensor BH1750!"));
|
||||||
}else{
|
}else{
|
||||||
|
i = Wire.read();
|
||||||
|
i <<=8;
|
||||||
|
i |= Wire.read();
|
||||||
|
|
||||||
// Calculate the Values
|
// Calculate the Values
|
||||||
Lux = i/1.2; // Convert to Lux
|
Lux = i/1.2; // Convert to Lux
|
||||||
|
|||||||
Reference in new issue
Block a user