Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update chapter-7/TempSketchSnippets

  • Loading branch information...
commit fd73fa6701b97a1c5962e9e4e9b1c6f4828610f6 1 parent 56d22b1
@ejgertz authored
Showing with 3 additions and 36 deletions.
  1. +3 −36 chapter-7/TempSketchSnippets
View
39 chapter-7/TempSketchSnippets
@@ -84,15 +84,8 @@ mySerialPort.print("8888");
delay(WDelay);
mySerialPort.print("xxxx");
delay(WDelay);
-
-
}
-
-
-
-
-
void loop(void)
{
float tempC;
@@ -100,15 +93,10 @@ float tempF;
float humid;
float dewPoint;
-
-
-
DHT22_ERROR_t errorCode;
-
delay(2000);
-
errorCode = myDHT22.readData();
Serial.print(errorCode);
@@ -125,9 +113,7 @@ switch(errorCode)
dispData((int)tempC, 'C');
tempF = (tempC*1.8)+32;
-
-
-
+
delay(WDelay);
dispData((int) tempF, 'F');
delay(WDelay);
@@ -147,9 +133,7 @@ switch(errorCode)
Serial.println("d");
delay(WDelay);
-
-
-
+
break;
case DHT_ERROR_CHECKSUM:
Serial.print("Error Cheksum");
@@ -174,34 +158,24 @@ switch(errorCode)
break;
}
-
-
-
}
-
-
float calculateDewpoint(float T, float RH)
{
// approximate dewpoint using the formula from wikipedia's article on dewpoint
-
float dp = 0.0;
float gTRH = 0.0;
float a = 17.271;
float b = 237.7;
-
gTRH = ((a*T)/(b+T))+log(RH/100);
dp = (b*gTRH)/(a-gTRH);
-
return dp;
}
-
-
void dispData(int i, char c)
{
@@ -211,8 +185,7 @@ void dispData(int i, char c)
return;
}
-
-
+
if((i<-999) || (i>9999))
{
mySerialPort.print("ERRx");
@@ -263,12 +236,6 @@ void dispData(int i, char c)
}
-
-
-
-
-
-
/*
DHT22.cpp - DHT22 sensor library
Developed by Ben Adams - 2011
Please sign in to comment.
Something went wrong with that request. Please try again.