patrickbaus / arduino-tmp1075 Goto Github PK
View Code? Open in Web Editor NEWArduino TMP1075 Library
License: GNU General Public License v3.0
Arduino TMP1075 Library
License: GNU General Public License v3.0
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.
I wonder if you were able to test this on Arduino platforms (such as the Mega 2560, for instance)
I will fork your repo and play around with the constructors, perhaps that will make the compiler happier
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
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.