Coder Social home page Coder Social logo

Comments (6)

psachs avatar psachs commented on June 27, 2024

Unfortunately we don't support to change I2C address on runtime.
You can simply modify the driver and change the I2C address

from arduino-i2c-sht4x.

F-Schmidt99 avatar F-Schmidt99 commented on June 27, 2024

Maybe I explained the issue with too little details, so for now I will reformulate it as a question.

How could I communicate with a sensor of type SHT40-BD1B-R2 using this library? I can not set the i2c address anywhere and the default is not 0x44 but 0x45

from arduino-i2c-sht4x.

qfisch avatar qfisch commented on June 27, 2024

Hej @F-Schmidt99 ,

Not sure @psachs still has this old issue under the radar so I will jump in.
In the file https://github.com/Sensirion/arduino-i2c-sht4x/blob/master/src/SensirionI2CSht4x.cpp you can change the I2C address to 0x45 by setting SHT4X_I2C_ADDRESS

I hope it helps
Cheers

Edit: to be clear I am talking about directly editing the file. Which typically is easier when you cloned the repository and transferred the driver to your project (instead of installing it using the Arduino library manager)

from arduino-i2c-sht4x.

F-Schmidt99 avatar F-Schmidt99 commented on June 27, 2024

Hello @qfisch,

thank you for the response.
I know how to control the sensor by editing the file. But keeping in mind, that this library is for the Arduino framework, and therefor also used by many beginners, I think, that you should provide either a constructor or a 'begin' method taking the i2c address as uint8_t address argument. Alternatively, you could also pass an enum value like this:

enum SHTSensorType {
A = 0x44,
B = 0x45
};

for better readable code.
See here for guidelines of Arduino: https://docs.arduino.cc/learn/contributions/arduino-creating-library-guide

Kind regards.

from arduino-i2c-sht4x.

qfisch avatar qfisch commented on June 27, 2024

Hej @F-Schmidt99 ,

I just saw your PR as well. As explained there, the feature is planned and should be rolled out soon through our typical generation process. I will keep this issue open to make sure to notify you once it is available.

Cheers
Q

from arduino-i2c-sht4x.

qfisch avatar qfisch commented on June 27, 2024

Driver is now updated to included this feature

from arduino-i2c-sht4x.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.