Fr4gg0r wrote:I transformed your lua code into a lua module (https://github.com/jrahlf/nodemcu-firmw ... 512224d0c3).
Edit: But it is bugged currently.
Wow - I'm delighted that you thought my code/idea was worth implementing - I'd be really pleased if it got pulled into the lua firmware!!
I will try to look at the code with my (much better programmer than I) buddy in the next day or two - together we might be able to squash some bugs!
Can I make a suggestion that may make it more useful for all of us?
Either - optionally the module could initialise the i2c bus with the pins that it found during scanning, returning the i2c address,
OR
The scan function could return the sda, scl and addr values - rather than just printing them.
The basic idea is that instead of defining pins, you could just call i2c_scan function and have the automagic do it's thing.
I really like this idea of getting the device to work out the wiring - I can't tell you how much time I've wasted getting the tx and rx the wrong way round etc.