GithubHelp home page GithubHelp logo

esp8266-am2315's Introduction

AM2315 Digital Temp & Humid Sensor Arduino Library for ESP8266

AM2315 I2C Library for Arduino

Test Devices

Aosong AM2315

Public functions

void begin(uint8_t dataPin, uint8_t clockPin);
void acquireData();
float temperature();
float humidity();
    

Usages

/*
  Test setup for WEMOS D1 Mini (ESP8266) and AM2315

  ---------------------------------------------------------------------------------
  WEMOS D1 Mini          AM2315                  Supply
  ---------------------------------------------------------------------------------
  D2 (SDA)               Yelloow (SDA)           4.7 k Pull-Up Resistor
  D1 (SCL)               White (SCL)             4.7 k Pull-Up Resistor
                         Red (VDD)               +3.3
  GND                    Black (GND)             GND

*/


#include <AM2315_I2C.h>

//ESP8266 I2C Pins
const uint8_t dataPin = D2;
const uint8_t  clockPin = D1;

AM2315_I2C am2315;

void setup() {
  Serial.begin(115200);

  Wire.pins(dataPin, clockPin);

  delay(100);

  Serial.println();

  am2315.begin(dataPin, clockPin);

  if (!am2315.dataReady)
    Serial.println("AM2315 sensor was not found");
  else
    Serial.println("AM2315 sensor is ready");

}

void loop() {

  //Non-blocking data reading
  am2315.acquireData();

  if (am2315.dataReady) {

    Serial.print("Humidity: ");
    Serial.println(am2315.humidity());
    Serial.print("Temperature: ");
    Serial.println(am2315.temperature());
    Serial.println();

  }

}

esp8266-am2315's People

Contributors

mobizt avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

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.