I am still struggling with generating the correct data. I looked into the blocking and non-blocking features of the DHT11 online but did not find anything too helpful.
My program code develops correct data every so often. Can you help me develop some code to pull the data in based on when DHT data is avaiable. I know you mentioed the non-blocking method but I am not having any luck on finding direction on that.
Any direction would be great.
my code as of now is:
//DHT11 SETUP
#include <dht.h>
dht DHT;
#define DHT11_PIN 7
//GPS SETUP
#include <TinyGPS++.h>
TinyGPSPlus gps;
//SD CARD SETUP
#include <SPI.h>
#include <SD.h>
void setup()
{
Serial.begin(9600);
Serial.println("Date,Time,Latitude,Longitude,Speed,Altitude,Number of Satellites,Temperature,Humidity");
Serial1.begin(9600);
}
void loop() // run over and over
{
int chk = DHT.read11(DHT11_PIN);
while (Serial1.available() > 0)
gps.encode(Serial1.read());
//if (gps.date.isUpdated())
Serial.print(gps.date.value()); // Raw date in DDMMYY format (u32)
Serial.print(",");
Serial.print(gps.time.value()); // Raw time in HHMMSSCC format (u32)
Serial.print(",");
Serial.print(gps.location.lat(), 2); // Latitude in degrees (double)
Serial.print(",");
Serial.print(gps.location.lng(), 2); // Longitude in degrees (double)
Serial.print(",");
Serial.print(gps.speed.mps()); // Speed in meters per second (double)
Serial.print(",");
Serial.print(gps.altitude.meters());
Serial.print(",");
Serial.print(gps.satellites.value()); // Number of satellites in use (u32)
Serial.print(",");
Serial.print(DHT.temperature);
Serial.print(",");
Serial.println(DHT.humidity);
}
My data generated looks like this:
21118,21051100,40.20,-84.50,0.03,305.30,9,23.00,62.00 <---- Good data set
21118,21051100,40.20,-84.50,0.03,305.30,9,-999.00,-999.00
21118,21051100,40.20,-84.50,0.03,305.30,9,-999.00,-999.00
21118,21051100,40.20,-84.50,0.03,305.30,9,-999.00,-999.00
21118,21051100,40.20,-84.50,0.03,305.30,9,-999.00,-999.00
21118,21051100,40.20,-84.50,0.03,305.30,9,-999.00,-999.00
21118,21051100,40.20,-84.50,0.03,305.30,9,-999.00,-999.00
21118,21051100,40.20,-84.50,0.03,305.30,9,-999.00,-999.00
21118,21051100,40.20,-84.50,0.03,305.30,9,-999.00,-999.00
21118,21051100,40.20,-84.50,0.03,305.30,9,-999.00,-999.00
21118,21051100,40.20,-84.50,0.03,305.30,9,-999.00,-999.00
21118,21051200,40.20,-84.50,0.10,305.30,9,-999.00,-999.00
21118,21051200,40.20,-84.50,0.10,305.30,9,-999.00,-999.00
21118,21051200,40.20,-84.50,0.10,305.10,9,-999.00,-999.00
21118,21051200,40.20,-84.50,0.10,305.10,9,-999.00,-999.00
21118,21051200,40.20,-84.50,0.10,305.10,9,-999.00,-999.00
21118,21051200,40.20,-84.50,0.10,305.10,9,-999.00,-999.00
21118,21051200,40.20,-84.50,0.10,305.10,9,-999.00,-999.00
21118,21051200,40.20,-84.50,0.10,305.10,9,-999.00,-999.00
21118,21051200,40.20,-84.50,0.10,305.10,9,23.00,61.00 <---- Good data set
21118,21051200,40.20,-84.50,0.10,305.10,9,-999.00,-999.00