GithubHelp home page GithubHelp logo

seeed-studio / seeed_grove_temperature_and_humidity_sensor_g Goto Github PK

View Code? Open in Web Editor NEW
2.0 15.0 0.0 160 KB

This library is used for Seeed graphical programming project

License: MIT License

C++ 100.00%

seeed_grove_temperature_and_humidity_sensor_g's Introduction

Grove_Temperature_And_Humidity_Sensor

This is an Arduino library for the DHT series of low cost temperature/humidity sensors.

To download. click the DOWNLOADS button in the top right corner, rename the uncompressed folder DHT. Check that the DHT folder contains DHT.cpp and DHT.h. Place the DHT library folder your /libraries/ folder. You may need to create the libraries subfolder if its your first library. Restart the IDE.

Note:

This library is used for Seeed graphical programming Project only.

API

/* 
 * Function Name: TemperatureHumidityRead 
 * Input - PinName: pin to connect 
 *         th - chanel choose 
 *              'T' - read temperature 
 *              'H' - read humidity 
 * Return - temperature or humidity 
 */  
float TemperatureHumidityRead(int PinName, char th); 

Note: 该函数读取间隔至少大于2s

Test Case

Get temperature and humidity, print to Serial monitor.

// test for seeed graphical programming project 
// loovee @ 2015-8-4 
#include "DHT.h" 
 
DHT dht; 
const int pinTh = 2; 
 
void setup() 
{ 
Serial.begin(115200); 
} 
 
void loop() 
{ 
    float temp, humi; 
     
    temp = dht.TemperatureHumidityRead(2, 'T'); 
    humi = dht.TemperatureHumidityRead(2, 'H'); 
     
    Serial.print(temp, 2); 
    Serial.print(" C\t"); 
    Serial.print(humi, 2); 
    Serial.println(" %"); 
     
    delay(2000); 
}

Analytics

seeed_grove_temperature_and_humidity_sensor_g's People

Stargazers

John Ryan avatar Drew Fustini avatar

Watchers

Yoshihiro TSUBOI avatar James Cloos avatar Xiaobo avatar Albert Miao avatar Baozhu Zuo avatar Jack Shao avatar Old Tang avatar Oden.Su avatar BBear avatar  avatar Jack Wu avatar  avatar  avatar Lakshantha Dissanayake 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.