Closed Coelhomatias closed 4 years ago
Device finds both sensors
Found the issue!! the begin() function also has a default address. Problem corrected with this:
#include<Arduino.h>
#include <Wire.h>
#include <BH1750.h>
BH1750 lightMeter1(0x23);
BH1750 lightMeter2(0x5C);
void setup(){
Serial.begin(9600);
Wire.begin(D1, D2);
lightMeter1.begin(BH1750::CONTINUOUS_HIGH_RES_MODE_2, 0x23);
lightMeter2.begin(BH1750::CONTINUOUS_HIGH_RES_MODE_2, 0x5C);
Serial.println(F("BH1750 Test"));
}
void loop() {
uint16_t lux1 = lightMeter1.readLightLevel();
uint16_t lux2 = lightMeter2.readLightLevel();
Serial.print("Light1: ");
Serial.print(lux1);
Serial.print(" lx. Light2: ");
Serial.print(lux2);
Serial.println(" lx.");
delay(1000);
}
@claws you should fix this. Closing the issue
Hi, using this code:
in a nodeMCU, like sugested in #25 but the output is the same for both, only reads from 0x23