mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-09-19 16:46:11 -04:00
1.1.1 DHTstable
This commit is contained in:
parent
58a602221e
commit
0c0e711fc0
@ -1,13 +1,14 @@
|
|||||||
//
|
//
|
||||||
// FILE: DHTStable.cpp
|
// FILE: DHTStable.cpp
|
||||||
// AUTHOR: Rob Tillaart
|
// AUTHOR: Rob Tillaart
|
||||||
// VERSION: 1.1.0
|
// VERSION: 1.1.1
|
||||||
// PURPOSE: DHT Temperature & Humidity Sensor library for Arduino
|
// PURPOSE: DHT Temperature & Humidity Sensor library for Arduino
|
||||||
// URL: https://github.com/RobTillaart/DHTstable
|
// URL: https://github.com/RobTillaart/DHTstable
|
||||||
//
|
//
|
||||||
// HISTORY:
|
// HISTORY:
|
||||||
|
|
||||||
// 1.1.0 2021-11-06 fix DHTNew-#67 negative temperature
|
// 1.1.1 2021-12-16 update library.json, license, minor edits
|
||||||
|
// 1.1.0 2021-11-06 fix DHTNew-#67 negative temperature
|
||||||
// 1.0.1 2021-06-01 change architecture to fix incompatible flag.
|
// 1.0.1 2021-06-01 change architecture to fix incompatible flag.
|
||||||
// 1.0.0 2021-05-26 rename files and class to DHTStable to fix incompatible flag.
|
// 1.0.0 2021-05-26 rename files and class to DHTStable to fix incompatible flag.
|
||||||
// changed temperature and humidity to private
|
// changed temperature and humidity to private
|
||||||
@ -15,7 +16,7 @@
|
|||||||
|
|
||||||
// 0.2.9 2021-02-27 fix URL in library.json
|
// 0.2.9 2021-02-27 fix URL in library.json
|
||||||
// 0.2.8 2021-02-01 fix negative temperature (from DHTStablenew)
|
// 0.2.8 2021-02-01 fix negative temperature (from DHTStablenew)
|
||||||
// 0.2.7 2020-12-20 add arduino-CI, unit test,
|
// 0.2.7 2020-12-20 add Arduino-CI, unit test,
|
||||||
// reset(), getTemperature(), getHumidity()
|
// reset(), getTemperature(), getHumidity()
|
||||||
// 0.2.6 2020-07-20 update URL in .cpp
|
// 0.2.6 2020-07-20 update URL in .cpp
|
||||||
// 0.2.5 2020-06-30 move to own repository; update headers mainly.
|
// 0.2.5 2020-06-30 move to own repository; update headers mainly.
|
||||||
@ -30,7 +31,7 @@
|
|||||||
// 0.1.11 renamed DHTLIB_TIMEOUT
|
// 0.1.11 renamed DHTLIB_TIMEOUT
|
||||||
// 0.1.10 optimized faster WAKEUP + TIMEOUT
|
// 0.1.10 optimized faster WAKEUP + TIMEOUT
|
||||||
// 0.1.09 optimize size: timeout check + use of mask
|
// 0.1.09 optimize size: timeout check + use of mask
|
||||||
// 0.1.08 added formula for timeout based upon clockspeed
|
// 0.1.08 added formula for timeout based upon clock speed
|
||||||
// 0.1.07 added support for DHT21
|
// 0.1.07 added support for DHT21
|
||||||
// 0.1.06 minimize footprint (2012-12-27)
|
// 0.1.06 minimize footprint (2012-12-27)
|
||||||
// 0.1.05 fixed negative temperature bug (thanks to Roseman)
|
// 0.1.05 fixed negative temperature bug (thanks to Roseman)
|
||||||
|
@ -2,18 +2,15 @@
|
|||||||
//
|
//
|
||||||
// FILE: DHTStable.h
|
// FILE: DHTStable.h
|
||||||
// AUTHOR: Rob Tillaart
|
// AUTHOR: Rob Tillaart
|
||||||
// VERSION: 1.1.0
|
// VERSION: 1.1.1
|
||||||
// PURPOSE: DHT Temperature & Humidity Sensor library for Arduino
|
// PURPOSE: DHT Temperature & Humidity Sensor library for Arduino
|
||||||
// URL: https://github.com/RobTillaart/DHTstable
|
// URL: https://github.com/RobTillaart/DHTstable
|
||||||
//
|
|
||||||
// HISTORY:
|
|
||||||
// see dht.cpp file
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
#include "Arduino.h"
|
#include "Arduino.h"
|
||||||
|
|
||||||
#define DHTSTABLE_LIB_VERSION (F("1.1.0 - DHTStable"))
|
#define DHTSTABLE_LIB_VERSION (F("1.1.1 - DHTStable"))
|
||||||
|
|
||||||
|
|
||||||
const int DHTLIB_OK = 0;
|
const int DHTLIB_OK = 0;
|
||||||
@ -61,8 +58,8 @@ public:
|
|||||||
float getHumidity() { return _humidity; };
|
float getHumidity() { return _humidity; };
|
||||||
float getTemperature() { return _temperature; };
|
float getTemperature() { return _temperature; };
|
||||||
|
|
||||||
bool getDisableIRQ() { return _disableIRQ; };
|
bool getDisableIRQ() { return _disableIRQ; };
|
||||||
void setDisableIRQ(bool b ) { _disableIRQ = b; };
|
void setDisableIRQ(bool b ) { _disableIRQ = b; };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint8_t _bits[5]; // buffer to receive data
|
uint8_t _bits[5]; // buffer to receive data
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2014-2021 Rob Tillaart
|
Copyright (c) 2014-2022 Rob Tillaart
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,22 +1,16 @@
|
|||||||
//
|
//
|
||||||
// FILE: dht11_test.ino
|
// FILE: dht11_test.ino
|
||||||
// AUTHOR: Rob Tillaart
|
// AUTHOR: Rob Tillaart
|
||||||
// VERSION: 1.0.0
|
|
||||||
// PURPOSE: DHT library test sketch for DHT11 && Arduino
|
// PURPOSE: DHT library test sketch for DHT11 && Arduino
|
||||||
// URL: https://github.com/RobTillaart/DHTstable
|
// URL: https://github.com/RobTillaart/DHTstable
|
||||||
//
|
|
||||||
// HISTORY:
|
|
||||||
// 1.0.0 2021-05-26 class name changed to DHTStable (breaking change)
|
|
||||||
//
|
|
||||||
// 0.2.0 use getHumidity() and getTemperature()
|
|
||||||
// 0.1.2 add URL in header
|
|
||||||
|
|
||||||
|
|
||||||
#include "DHTStable.h"
|
#include "DHTStable.h"
|
||||||
|
|
||||||
DHTStable DHT;
|
DHTStable DHT;
|
||||||
|
|
||||||
#define DHT11_PIN 5
|
#define DHT11_PIN 5
|
||||||
|
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
@ -58,4 +52,5 @@ void loop()
|
|||||||
delay(2000);
|
delay(2000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// -- END OF FILE --
|
// -- END OF FILE --
|
||||||
|
@ -1,22 +1,16 @@
|
|||||||
//
|
//
|
||||||
// FILE: dht12_test.ino
|
// FILE: dht12_test.ino
|
||||||
// AUTHOR: Rob Tillaart
|
// AUTHOR: Rob Tillaart
|
||||||
// VERSION: 1.0.0
|
|
||||||
// PURPOSE: DHT library test sketch for DHT12 && Arduino
|
// PURPOSE: DHT library test sketch for DHT12 && Arduino
|
||||||
// URL: https://github.com/RobTillaart/DHTstable
|
// URL: https://github.com/RobTillaart/DHTstable
|
||||||
//
|
|
||||||
// HISTORY:
|
|
||||||
// 1.0.0 2021-05-26 class name changed to DHTStable (breaking change)
|
|
||||||
//
|
|
||||||
// 0.2.0 use getHumidity() and getTemperature()
|
|
||||||
// 0.1.1 add URL in header
|
|
||||||
|
|
||||||
|
|
||||||
#include "DHTStable.h"
|
#include "DHTStable.h"
|
||||||
|
|
||||||
DHTStable DHT;
|
DHTStable DHT;
|
||||||
|
|
||||||
#define DHT12_PIN 5
|
#define DHT12_PIN 5
|
||||||
|
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
@ -57,4 +51,6 @@ void loop()
|
|||||||
delay(2000);
|
delay(2000);
|
||||||
}
|
}
|
||||||
|
|
||||||
// END OF FILE
|
|
||||||
|
// -- END OF FILE --
|
||||||
|
|
||||||
|
@ -1,27 +1,15 @@
|
|||||||
//
|
//
|
||||||
// FILE: dht22_test.ino
|
// FILE: dht22_test.ino
|
||||||
// AUTHOR: Rob Tillaart
|
// AUTHOR: Rob Tillaart
|
||||||
// VERSION: 1.0.0
|
|
||||||
// PURPOSE: DHT library test sketch for DHT22 && Arduino
|
// PURPOSE: DHT library test sketch for DHT22 && Arduino
|
||||||
// URL: https://github.com/RobTillaart/DHTstable
|
// URL: https://github.com/RobTillaart/DHTstable
|
||||||
//
|
|
||||||
// HISTORY:
|
|
||||||
// 1.0.0 2021-05-26 class name changed to DHTStable (breaking change)
|
|
||||||
//
|
|
||||||
// 0.2.0 use getHumidity() and getTemperature()
|
|
||||||
// 0.1.4 add URL in header
|
|
||||||
// 0.1.03 extended stats for all errors
|
|
||||||
// 0.1.02 added counters for error-regression testing.
|
|
||||||
// 0.1.01 ?
|
|
||||||
// 0.1.00 initial version
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
#include "DHTStable.h"
|
#include "DHTStable.h"
|
||||||
|
|
||||||
DHTStable DHT;
|
DHTStable DHT;
|
||||||
|
|
||||||
#define DHT22_PIN 5
|
#define DHT22_PIN 5
|
||||||
|
|
||||||
|
|
||||||
struct
|
struct
|
||||||
@ -36,6 +24,7 @@ struct
|
|||||||
uint32_t unknown;
|
uint32_t unknown;
|
||||||
} counter = { 0,0,0,0,0,0,0,0};
|
} counter = { 0,0,0,0,0,0,0,0};
|
||||||
|
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
@ -46,6 +35,7 @@ void setup()
|
|||||||
Serial.println("Type,\tstatus,\tHumidity (%),\tTemperature (C)\tTime (us)");
|
Serial.println("Type,\tstatus,\tHumidity (%),\tTemperature (C)\tTime (us)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
// READ DATA
|
// READ DATA
|
||||||
@ -108,4 +98,6 @@ void loop()
|
|||||||
delay(2000);
|
delay(2000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// -- END OF FILE --
|
// -- END OF FILE --
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Syntax Coloring Map For DHTStable
|
# Syntax Colouring Map For DHTStable
|
||||||
|
|
||||||
# Datatypes (KEYWORD1)
|
# Data types (KEYWORD1)
|
||||||
DHTStable KEYWORD1
|
DHTStable KEYWORD1
|
||||||
|
|
||||||
|
|
||||||
@ -13,16 +13,15 @@ read21 KEYWORD2
|
|||||||
read22 KEYWORD2
|
read22 KEYWORD2
|
||||||
read33 KEYWORD2
|
read33 KEYWORD2
|
||||||
read44 KEYWORD2
|
read44 KEYWORD2
|
||||||
|
|
||||||
read2301 KEYWORD2
|
read2301 KEYWORD2
|
||||||
read2302 KEYWORD2
|
read2302 KEYWORD2
|
||||||
read2320 KEYWORD2
|
read2320 KEYWORD2
|
||||||
read2322 KEYWORD2
|
read2322 KEYWORD2
|
||||||
|
|
||||||
getHumidity KEYWORD2
|
getHumidity KEYWORD2
|
||||||
getTemperature KEYWORD2
|
getTemperature KEYWORD2
|
||||||
|
|
||||||
### obsolete in future
|
|
||||||
humidity KEYWORD2
|
|
||||||
temperature KEYWORD2
|
|
||||||
|
|
||||||
# Instances (KEYWORD2)
|
# Instances (KEYWORD2)
|
||||||
|
|
||||||
@ -30,3 +29,8 @@ temperature KEYWORD2
|
|||||||
# Constants (LITERAL1)
|
# Constants (LITERAL1)
|
||||||
DHTSTABLE_LIB_VERSION LITERAL1
|
DHTSTABLE_LIB_VERSION LITERAL1
|
||||||
|
|
||||||
|
DHTLIB_OK LITERAL1
|
||||||
|
DHTLIB_ERROR_CHECKSUM LITERAL1
|
||||||
|
DHTLIB_ERROR_TIMEOUT LITERAL1
|
||||||
|
DHTLIB_INVALID_VALUE LITERAL1
|
||||||
|
|
||||||
|
@ -15,8 +15,9 @@
|
|||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/RobTillaart/DHTstable.git"
|
"url": "https://github.com/RobTillaart/DHTstable.git"
|
||||||
},
|
},
|
||||||
"version": "1.1.0",
|
"version": "1.1.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"frameworks": "arduino",
|
"frameworks": "arduino",
|
||||||
"platforms": "*"
|
"platforms": "*",
|
||||||
|
"headers": "DHTStable.h"
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
name=DHTStable
|
name=DHTStable
|
||||||
version=1.1.0
|
version=1.1.1
|
||||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||||
sentence=Stable version of library for DHT Temperature & Humidity Sensor
|
sentence=Stable version of library for DHT Temperature & Humidity Sensor
|
||||||
|
@ -17,9 +17,9 @@ The DHTStable library is a "frozen" version of the DHTlib.
|
|||||||
This version is stable for both ARM and AVR.
|
This version is stable for both ARM and AVR.
|
||||||
|
|
||||||
0.2.5 is a migration to its own repository.
|
0.2.5 is a migration to its own repository.
|
||||||
0.2.6 fixed URL to new repro
|
0.2.6 fixed URL to new repository
|
||||||
0.2.7 getTemperature() and getHumidity() added
|
0.2.7 getTemperature() and getHumidity() added
|
||||||
added arduino-ci + unit test.
|
added Arduino-CI + unit test.
|
||||||
0.2.8 fix negative temperature
|
0.2.8 fix negative temperature
|
||||||
0.2.9 fix URL in JSON file
|
0.2.9 fix URL in JSON file
|
||||||
|
|
||||||
@ -44,5 +44,12 @@ See examples.
|
|||||||
|
|
||||||
## Future
|
## Future
|
||||||
|
|
||||||
- follow bug fixes from DHTnew?
|
- no active development
|
||||||
-
|
- follow bug fixes from DHTnew
|
||||||
|
- on request.
|
||||||
|
- move some const int to .cpp file
|
||||||
|
- improve unit test
|
||||||
|
- add constants test
|
||||||
|
- add release_notes
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
unittest_setup()
|
unittest_setup()
|
||||||
{
|
{
|
||||||
|
fprintf(stderr, "DHTSTABLE_LIB_VERSION %s\n", (char *) DHTSTABLE_LIB_VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
unittest_teardown()
|
unittest_teardown()
|
||||||
@ -38,7 +39,6 @@ unittest(test_constructor)
|
|||||||
{
|
{
|
||||||
DHTStable dht;
|
DHTStable dht;
|
||||||
|
|
||||||
fprintf(stderr, "%s\n", DHTSTABLE_LIB_VERSION);
|
|
||||||
assertFalse(dht.getDisableIRQ());
|
assertFalse(dht.getDisableIRQ());
|
||||||
|
|
||||||
dht.setDisableIRQ(true);
|
dht.setDisableIRQ(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user