Comments (3)
You can create runtime an DHTNEW object with the pin you want.
Never tried it however, please let me know if it works and I will add it to the examples
//
// FILE: dhtnew_runtime.ino
// AUTHOR: Rob Tillaart
// VERSION: 0.1.0
// PURPOSE: DHTNEW library test sketch
// URL: https://github.com/RobTillaart/DHTNew
//
// HISTORY:
// 0.1.0 2020-01-04 intial version
//
// DHT PIN layout from left to right
// =================================
// FRONT : DESCRIPTION
// pin 1 : VCC
// pin 2 : DATA
// pin 3 : Not Connected
// pin 4 : GND
#include <dhtnew.h>
// DHTNEW mySensor(16); not needed
uint32_t lastTime = 0;
void setup()
{
Serial.begin(115200);
Serial.println(__FILE__);
Serial.println(DHTNEW_LIB_VERSION);
}
void loop()
{
if (millis() - lastTime > 2000)
{
lastTime = millis();
for (int pin = 6; pin < 10; pin++)
{
DHTNEW sensor(pin);
sensor.read();
Serial.print(pin);
Serial.print("\t");
Serial.print(sensor.getHumidity(), 1);
Serial.print("\t");
Serial.println(sensor.getTemperature(), 1);
}
}
// Do other things here
}
// END OF FILE
from dhtnew.
from dhtnew.
ooops , copy paste error ...
I will comment it in the example
from dhtnew.
Related Issues (20)
- Still problems with measuring negative values (AM2301) HOT 4
- Sensors getting stuck at a certain value HOT 37
- Fix negative temperature below -25.5°C HOT 1
- Humidity values higher than 100% HOT 17
- F_CPU not defined for Arduino Nano RP2040 Connect HOT 3
- read() hangs with MkrWiFi + MkrConnector Board HOT 66
- DTH11 gets too short start impulse HOT 16
- setTempOffset and setHumOffset HOT 3
- Support for SonOff Si7021 HOT 10
- ESP32 error HOT 13
- Test sketch HOT 4
- Si7021 by Sonoff HOT 16
- DHT22 registers as type 70 in 0.4.14 HOT 12
- Support for DS18B20 HOT 3
- Sonoff Si7021 gives wrong temperature and humidity HOT 5
- Compiler warning, conversion float to double HOT 7
- Ticker compatibility HOT 12
- Add support for the AM2320, AM2321 and AM2322.
- consider an enhancement to be able to compile this lib directly under espressif/platformio without Arduino layer HOT 4
- Parallel processing of multiple Sensors HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dhtnew.