and the last bit
//Setting the Light Intensity, in 5 steps
void set_step()
{
delay(300);
lcd.setCursor(0,0);
lcd.print("Set Step Light");
while (digitalRead(button_menu)==LOW)
{
if (readdial(5,1)==0) //from readdial, we get 5 menu options
{
stepval = readdial(5,1); //step 0, lowest values
tempval_min = 40;
tempval_max = 120;
tempval_avg = 60;
lcd.setCursor(0, 1);
lcd.print("Step 0");
delay(100);
}
else if (readdial(5,1)==1) //step 1
{
stepval = readdial(5,1);
tempval_min = 50;
tempval_max = 150;
tempval_avg = 80;
lcd.setCursor(0, 1);
lcd.print("Step 1");
delay(100);
}
else if (readdial(5,1)==2) //step 2
{
stepval = readdial(5,1);
tempval_min = 60;
tempval_max = 180;
tempval_avg = 100;
lcd.setCursor(0, 1);
lcd.print("Step 2");
delay(100);
}
else if (readdial(5,1)==3) //step 3
{
stepval = readdial(5,1);
tempval_min = 70;
tempval_max = 210;
tempval_avg = 120;
lcd.setCursor(0, 1);
lcd.print("Step 3");
delay(100);
}
else if (readdial(5,1)==4) //step 4
{
stepval = readdial(5,1);
tempval_min = 100;
tempval_max = 240;
tempval_avg = 180;
lcd.setCursor(0, 1);
lcd.print("Step 4");
delay(100);
}
}
}
//Setting the fan rpm, in 4 steps
void set_rpm()
{
delay(300);
lcd.setCursor(0,0);
lcd.print("Set Fan RPM");
while (digitalRead(button_menu)==LOW)
{
if (readdial(4,1)==0) //from readdial, we get 4 menu options
{ //step 0
fanval = 200;
fan_step = readdial(4,1);
lcd.setCursor(0, 1);
lcd.print("Step 0");
delay(100);
}
else if (readdial(4,1)==1) //step 1
{
fanval = 350;
fan_step = readdial(4,1);
lcd.setCursor(0, 1);
lcd.print("Step 1");
delay(100);
}
else if (readdial(4,1)==2) //step 2
{
fanval = 500;
fan_step = readdial(4,1);
lcd.setCursor(0, 1);
lcd.print("Step 2");
delay(100);
}
else if (readdial(4,1)==3) //step 3
{
fanval = 700;
fan_step = readdial(4,1);
lcd.setCursor(0, 1);
lcd.print("Step 3");
delay(100);
}
}
}
//Calculating average temperature for LOGGER
void calc_avg_temp()
{
delay(300);
sum_temp = 0; //reset the sum
int c=0;
for (c=0; c<=5; c++)
{
sum_temp = sum_temp + temp_data[c]; //calculate sum of samples taken
delay(10);
}
if (c>5) //loop to make sure that we wont
{ //read any data outside the specified array
c=0;
}
delay(500);
avg_temp = 0; //reset the average temperature
delay(100);
avg_temp = sum_temp/6; //calculate average of samples taken
lcd.clear();
lcd.setCursor(0,0);
lcd.print(" Last Hour"); //display info
lcd.setCursor(0, 1);
lcd.print("Avg Temp:");
lcd.print(avg_temp, 1);
lcd.print("C");
delay(3000);
}
//Calculate average humidity for LOGGER
void calc_avg_hum()
{
delay(300);
sum_hum = 0; //reset the sum
int d=0;
for (d=0; d<=5; d++)
{
sum_hum = sum_hum + hum_data[d]; //calculate sum of samples taken
delay(10);
}
if (d>5)
{
d=0;
}
delay(500);
avg_hum = 0; //reset the average temperature
delay(100);
avg_hum = sum_hum/6; //calculate average of samples taken
lcd.clear();
lcd.setCursor(0,0);
lcd.print(" Last Hour"); //display info
lcd.setCursor(0, 1);
lcd.print("Avg Hum:");
lcd.print(avg_hum, 2);
lcd.print("%");
delay(3000);
}
/*if we get hardware for producing humidity...
void set_hum() {
}
void set_hum_dif() {
}
*/