Skip to content

BH1750Address

Starmbi edited this page Feb 3, 2020 · 1 revision

address

adjustable address to communicate with this sensor over wire.

enum BH1750Address
{
  BH1750_TO_GROUND = 0x23,
  BH1750_TO_VCC = 0x5C
};

Hint:

Parameter byte address

For the BH1750 there a two available addresses: 0x23 and 0x5C.
To choose 0x23, you have to connect the address pin to ground.
For 0x5C, you have to connect the address pin to VCC.
With the breakout boards GY-30 and GY-302, you can connect this pin to 5V or to 3.3V.
To make it easier, to choose the right address, the library provides this enum:

So just call:

bool avail = BH1750_1.begin(BH1750_TO_VCC);
bool avail = BH1750_2.begin(BH1750_TO_GROUND);  

No check for correct address.

See also begin

Clone this wiki locally