I'm making a shield for the Mega 2560, but I've hit some PCB layout constraints due to the amount of stuff I tried to fit onto the board.
As a temporary stopgap measure until I redesign and remake the PCBs, I'd like to add a Lux sensor, the BH1750, onto ports 22 and 24 of the Arduino Mega 2560. Of course the Mega's "native" SCL and SDA ports are 20 and 21 (indeed I'm using these for an MPR121 proximity sensor) and eventually I will hook up the Lux sensor to those ports as well.
robtillaart:
normally an I2C can handle multiple device (up to 120 or so) .
Is that not an option?
'fraid not, I can't physically access the existing device as it's buried under some others and don't want to bodge the soldering on a few test units I've already made.
So basically I need a stopgap solution using software
1/ I'm not sure whether it will coexist with Wire.h
2/ I'm not sure how to get it to work with this BH1750 library (or any other)
The lib is now Wire based so you need to "rewire" it with the soft12C lib. That means in practice replace all (10-15) references to Wire.xyz() with the appropriate equivalent of the softlib.
e.g. Wire.read() becomes i2c_read()
Not done this before but if you are lucky it will 30 minutes work.