GithubHelp home page GithubHelp logo

arduino-tmp1075's People

Contributors

mimosa-oceanis avatar patrickbaus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

arduino-tmp1075's Issues

Call of overloaded "<method>" is ambiguous

Dear Patrick

I plan to use your library to read a group of devices mounted on a custom PCB.
I am facing some issues with the current implementation. it seems like the I2C address should be passed explicitly to the private value.

image

I wonder if you were able to test this on Arduino platforms (such as the Mega 2560, for instance)

image

I will fork your repo and play around with the constructors, perhaps that will make the compiler happier

Modifications on objects constructor to make instantiation more "generic"

Dear Patrick

This is not an issue per se, but rather a heads-up.

I am working on my own fork at the moment on a version that makes it possible to instantiate TMP1075 sensors through a more efficient* boilerplate. This can be done by eliminating the need to pre-define the device's addresses at object creation. Defining a device's address can be done via a separate public method.

This would allow us to make device "containers" like the following structure-based implementation (a skimmed version of it):

    uint8_t deviceAddressses[4] = {0x49, 0x4B, 0x4D, 0x4F};
 
    TwoWire wire = Wire;
    
    // In this case, the structure refers to a "device" PCB that has two sensors on it, however, it can be extended
    typedef struct TMP1075Group {

        float tempValues[2] = {0.0f, 0.0f};
        TMP1075 sensors[2] = {TMP1075(wire), TMP1075(wire)};

    } TMP1075Group;

    TMP1075Group group1;    // Each group has a specific address that will be configured in the Setup function
    TMP1075Group group2;

    void setup( ){

        // Initialize the sensors groups configuring their addresses and initializing them
            for (int idx = 0; idx < 4; idx++) {
                
                if (idx < 2) {
                    group1.sensors[idx].setAddress(deviceAddressses[idx]);
                    group1.sensors[idx].begin();
                }

                if (idx >= 2) {
                    group2.sensors[idx].setAddress(deviceAddressses[idx]);
                    group2.sensors[idx].begin();
                }

            }
    }

    void loop( ) {

        unsigned long now = millis();
    
        if (now - prevSampleTime >= 5000) {
            prevSampleTime = now;
    
            while (valuePtr < 4) {

                if (valuePtr < 2) {
                    tempVals[valuePtr] = group1.sensors[devicePtr].getTemperatureCelsius( );
                    devicePtr++;
                }
    
                if (valuePtr >= 2) {
                    devicePtr = 0;  // Saving data on the second group requires restarting the pointer
                    tempVals[valuePtr] = group2.sensors[devicePtr].getTemperatureCelsius( );
                    devicePtr++;
                }
    
                valuePtr++;
            }
    
            valuePtr = 0;
            devicePtr = 0;

        }
    }

I have not thoroughly tested this, however, this is a general idea that I believe might work just fine.

I recently started working on a project that uses a bunch of these sensors placed across different PCBs and thus my need to propose something like this.

I would also like to either rename the namespace or eliminate it as it is unlikely that users will face a situation where other classes are named "TMP1075".

Are these ideas something that you would find interesting?

I will keep working on this in the upcoming days and submit a PR for your review. I do NOT expect you to merge it. It's just for you to become aware of my changes and comment on them ๐Ÿ˜‰

Thanks for your time.

Cheers ๐Ÿป

*by efficient I mean one that can be more flexible and robust in general scenarios

Missing .properties file when using Arduino IDE

Hi Patrick,

Thank you very much for creating this library. I am yet to try it with an actual device.
One thing I have noticed is that the repo is missing the library.properties file which is apparently a key file to have when using the Arduino IDE. Without this file the IDE does not recognize it as a library and therefore fails the installing process. This might be obvious for an experienced coder but I am a novice myself and it took me a while to get to the bottom of it.

Again, thank you for the library and hopefully one day I get to a point when I can write my own libraries to share.

Kind regards.

David

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.