remove wire.begintransmission and end as there is no writing

#89
This commit is contained in:
1technophile committed 2017-11-11 13:36:24 +01:00
1 parent d094ff3b74
commit 974d738212
1 file changed
+4 -7
+4 -7
View File
@@ -64,16 +64,13 @@ void MeasureLightIntensity()
float Wattsm2;
// Check if reads failed and exit early (to try again).
Wire.beginTransmission(BH1750_i2c_addr);
Wire.requestFrom(BH1750_i2c_addr, 2);
while(Wire.available()) //
{
i <<=8;
i|= Wire.read();
}
if (Wire.endTransmission() != 0 ) {
if(Wire.available() != 2) {
trc(F("Failed to read from LightSensor BH1750!"));
}else{
i = Wire.read();
i <<=8;
i |= Wire.read();
// Calculate the Values
Lux = i/1.2; // Convert to Lux