Currently I am trying to use the RTC Ds1307 to take timed measurements of temperature and humidity between 6-10 every morning and evening every hour. The code looks for a change in temp of 10 degrees and 6 percent humidity, and then subtracts the stored hourly values from current value. Then my code outputs a boolean on whter those differences it temperature and humidity are large enough. My question is does it look like my code will do exactly that.
,,,
#include <Wire.h>
#include "RTClib.h"
#include <DHT.h>
#define DHTPIN 9 // What digital pin we're connected to
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
DateTime now;
void setup()
{
// Debug console
Serial.begin(9600);
Serial.begin(9600); //Just for testing
Wire.begin();
RTC_DS1307 RTC;
DateTime now = RTC.now();
RTC.begin();
}
void check_values(){
while(now.hour()>06&&now.minute()<01||now.hour()>18&&now.minute()<01){
read_temp = dht.readTemperature(true);
read_humidity = dht.readTemperature(true);
}
while(now.hour()>07&&now.minute()<01||now.hour()>19&&now.minute()<01){
read_temp_2 = dht.readTemperature(true);
read_humidity_2 = dht.readTemperature(true);
}
while(now.hour()>8&&now.minute()<01||now.hour()>20&&now.minute()<01){
read_temp_3 = dht.readTemperature(true);
read_humidity_3 = dht.readTemperature(true);
}
while(now.hour()>9&&now.minute()<01||now.hour()>21&&now.minute()<01){
read_temp_4 = dht.readTemperature(true);
read_humidity_4 = dht.readTemperature(true);
}
while(now.hour()>10&&now.minute()<01||now.hour()>22&&now.minute()<01){
read_temp_5 = dht.readTemperature(true);
read_humidity_5 = dht.readTemperature(true);
}
float f = dht.readTemperature(true);
float h = dht.readHumidity();
// determinig temperature drop or increase
delta_temp=(f-read_temp);
delta_temp=(f-read_temp_2);
delta_temp=(f-read_temp_3);
delta_temp=(f-read_temp_4);
delta_temp=(f-read_temp_5);
// determing humidity drop or increase
delta_humidity=(h-read_humidity);
delta_humidity=(h-read_humidity_2);
delta_humidity=(h-read_humidity_3);
delta_humidity=(h-read_humidity_4);
delta_humidity=(h-read_humidity_5);
if ((delta_temp>=10||delta_temp<=-10)&& (delta_humidity>=6||delta_humidity<=-6)){
level_change=true;
Serial.print("Delta values achieved");
}
else{
level_change=false;
}
}
void loop()
{
check_values();
}
Have you tried to run the code? Does the code compile? What does the code actually do?
With 6 posts one would hope that you have read the how to use this forum-please read sticky. It tells how to post code pdoperly. It would make your code easier to follow if you use the autoformat tool in the IDE (ctrl-t or Tools, Auto Format) to indent your code.
read_humidity = dht.readTemperature(true);
read_humidity_2 = dht.readTemperature(true);
read_humidity_3 = dht.readTemperature(true);
read_humidity_4 = dht.readTemperature(true);
read_humidity_5 = dht.readTemperature(true);
Why are you calling dht.readTemperature() and saving the result in a variable called read_humidity?!?
// determinig temperature drop or increase
delta_temp = (f - read_temp);
delta_temp = (f - read_temp_2);
delta_temp = (f - read_temp_3);
delta_temp = (f - read_temp_4);
delta_temp = (f - read_temp_5);
You keep overwriting the previous answers so the first four are ignored.
// determing humidity drop or increase
delta_humidity = (h - read_humidity);
delta_humidity = (h - read_humidity_2);
delta_humidity = (h - read_humidity_3);
delta_humidity = (h - read_humidity_4);
delta_humidity = (h - read_humidity_5);
Same here. You keep overwriting the previous answers so the first four are ignored.
The code does compile but does not work the way it should. No I have not read the sticky, and having trouble finding it. Here is what I want the code to do. Take measurement on the first minute of every hour of temp and humidity. Then I want to compare the first reading with the others , and when a difference of 10 degrees and 6 percent humidity is achieved I want it to set a boolean true. However as of now the code the delta_temp and read_temp are the same values and the same thing goes for humidity. Are there any ideas on what I should change or do instead ? I am very new to this forum and have little understanding of how it operate. I will get better though. 
No I have not read the sticky, and having trouble finding it.
Titled "How to use this forum", at the top of forum section.
Are there any ideas on what I should change or do instead ?
Edit your post to add code tags, as described in the "How to use this forum" post, and carefully read the responses. They point out serious errors in the code.
Quikksilver:
Here is what I want the code to do. Take measurement on the first minute of every hour of temp and humidity.
Easy. Just look for when the hour is different from the hour of the previous reading, take your samples, and record the new hour as the hour of the previous reading.
Quikksilver:
Then I want to compare the first reading with the others
How many others?
Quikksilver:
and when a difference of 10 degrees and 6 percent humidity is achieved I want it to set a boolean true.
A total of 10 degrees or more when you add all the differences together? Or 10 degrees difference in one (or more) comparisons? Same questions for humidity. Are you sure you mean 'and'? If the humidity changes 40% but the temperature only changes 9 degrees you don't care? If the temerature changes 30 degrees but the humidity only changes 5% you don't care?
Quikksilver:
However as of now the code the delta_temp and read_temp are the same values and the same thing goes for humidity. Are there any ideas on what I should change or do instead ? I am very new to this forum and have little understanding of how it operate. I will get better though. 
The Arduino does what you tell it to do. The first step is to decide EXACTLY what you want to tell it to do. If you can right that down in enough detail, the sketch will just be a translation of the description.