SignalK / SensESP

Universal Signal K sensor framework for the ESP32 platform
https://signalk.org/SensESP/
Apache License 2.0
154 stars 81 forks source link

How to specify SDA, SCL for I2C? #512

Closed nadrog closed 2 years ago

nadrog commented 2 years ago

Hi, can you please explain what's the right way to define specific SDA and SCL pins for I2C? Thanks!

ba58smith commented 2 years ago

Version 1 of SensESP's Sensors doesn't work with non-standard I2C pins. Version 2.0 is going to completely change how SensESP works with I2C sensors, but version 2.0 is still a WIP.

If you tell me the specific I2C sensor you're working with, I'll try to give you the code to make it work with version 1.

nadrog commented 2 years ago

Actually, I found out that if I simply configure Wire before sensor is instantiated, it all works. My code now looks like following: Wire.begin(SDA_PIN, SCL_PIN, FREQUENCY); auto* bme280 = new BME280(0x76);

On Sat, Jan 8, 2022 at 4:21 PM Brian Smith @.***> wrote:

Version 1 of SensESP's Sensors doesn't work with non-standard I2C pins. Version 2.0 is going to completely change how SensESP works with I2C sensors, but version 2.0 is still a WIP.

If you tell me the specific I2C sensor you're working with, I'll try to give you the code to make it work with version 1.

— Reply to this email directly, view it on GitHub https://github.com/SignalK/SensESP/issues/512#issuecomment-1008023490, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABXQ476QIII5H6LJ3YQG573UVBI6RANCNFSM5LQQWKCA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

ba58smith commented 2 years ago

Excellent. I'll close this.