switchdoclabs / sdl_esp8266_am2315 Goto Github PK
View Code? Open in Web Editor NEWESP8266 Version of the AM2315 Temperature/Humidity Sensor
ESP8266 Version of the AM2315 Temperature/Humidity Sensor
SwitchDoc Labs Modifications for ESP8266 This is a library for the AM2315 Humidity & Temp Sensor www.switchdoc.com This works for both the SwitchDoc Labs AM2315 and the Adafruit AM2315 Note: There are ESP8266-12 modules that have pins 4 and 5 reversed. The one we are testing has these lines reversed, hence the statement: Wire.begin(5,4); If you have the lines in your ESP8266 correct, then change this to Wire.begin(4,5) This is a library for the AM2315 Humidity + Temp sensor Designed specifically to work with the AM2315 in the Adafruit shop ----> https://www.adafruit.com/products/1293 These displays use I2C to communicate, 2 pins are required to interface Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit! Written by Limor Fried/Ladyada for Adafruit Industries. BSD license, all text above must be included in any redistribution Check out the links above for our tutorials and wiring diagrams To download. click the ZIP button in the top-middle navbar, rename the uncompressed folder Adafruit_AM2315. Check that the Adafruit_AM2315 folder contains Adafruit_AM2315.cpp and Adafruit_AM2315.h Place the Adafruit_AM2315 library folder your arduinosketchfolder/libraries/ folder. You may need to create the libraries subfolder if its your first library. Restart the IDE. We also have a great tutorial on Arduino library installation at: http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use
In the example, there is an extra '}' at the end.
void loop() {
Serial.print("Hum: "); Serial.println(am2315.readHumidity());`
Serial.print("Temp: "); Serial.println(am2315.readTemperature());
delay(1000);
}}
The last '}' seems to be extra (and gives me an error).
The extra '}' was also found in the original Adafruit AM2315 repository a while ago and fixed there.
Hi,
negative temp are not managed in this lib.
See https://github.com/switchdoclabs/SDL_ESP8266_HR_AM2315/blob/master/SDL_ESP8266_HR_AM2315.cpp
I suggest to add:
// change sign
if (reply[4] & 0x80) {
temp = -temp;
}
right after :
temp = reply[4];
temp *= 256;
temp += reply[5];
temp /= 10;
//Serial.print("T"); Serial.println(temp);
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.