Skip to content

Feature/add set pin and type #192

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions DHT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,24 @@ void DHT::begin(uint8_t usec) {
pullTime = usec;
}

/*!
* @brief Sets the _pin property value
* @param newPin
* pin number that sensor is connected
*/
void DHT::setPin(uint8_t newPin){
_pin = newPin;
}

/*!
* @brief Sets the _type property value
* @param newType
* type of sensor
*/
void DHT::setType(uint8_t newType){
_type = newType;
}

/*!
* @brief Read temperature
* @param S
Expand Down
2 changes: 2 additions & 0 deletions DHT.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ class DHT {
public:
DHT(uint8_t pin, uint8_t type, uint8_t count = 6);
void begin(uint8_t usec = 55);
void setPin(uint8_t newPin);
void setType(uint8_t newType);
float readTemperature(bool S = false, bool force = false);
float convertCtoF(float);
float convertFtoC(float);
Expand Down