romainmp / htu21d Goto Github PK
View Code? Open in Web Editor NEWSpark Core library for the HTU21D sensor
License: GNU General Public License v3.0
Spark Core library for the HTU21D sensor
License: GNU General Public License v3.0
There is no need to wait for something after a Wire.requestFrom().
When the Wire.requestFrom() returns, I2C bus transaction has completely finished and the received data is waiting in a buffer in the Wire library.
These pieces of code can be removed:
//Wait for data to become available
int counter = 0;
while(!Wire.available()){
counter++;
delay(1);
if(counter > 100) return HTU21D_I2C_TIMEOUT; //after 100ms consider I2C timeout
}
If you want, then it is possible to test if the Wire.requestFrom() was succesful or not:
Wire.requestFrom(HTDU21D_ADDRESS, 3);
//Test if something was wrong
if(Wire.available() != 3){
return HTU21D_I2C_TIMEOUT;
}
uint16_t h = Wire.read();
h <<= 8;
h |= Wire.read();
You could replace the "TIMEOUT" error with a more appropriate name. When it failed, the Slave was not answering or there was a bus error.
Hi @romainmp.
I'm trying to get the code running with the adafruit HTU21DF and your library but it's not working. I just create the htu object and then see !htu.begin()
The LED in the front of the photon doesn't breathe cyan anymore (It's fixed) It's like the micro isn't responding. Do you know anything about this?
Thanks!
Veryfing code using this library in Particle Build fails with this error:
HTU21D/HTU21D.h:39:7: error: redefinition of 'class HTU21D'
class HTU21D {
^
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.