Garduino Code Errors

Hi,

I know there are a lot of posts out there from people who tried to build their "Garduino" Arduino based plant watering system but I haven't seen anything to help me with my specific problem. I'm using the code found here: http://archive.makezine.com/18/garduino/

I've tried the code with #include <DateTime.h> and #include <Time.h> as well as trying them together.

//include the datetime library, so our garduino can keep track of how long the lights are on
#include 

//define analog inputs to which we have connected our sensors
int moistureSensor = 0;
int lightSensor = 1;
int tempSensor = 2;

//define digital outputs to which we have connecte our relays (water and light) and LED (temperature)
int waterPump = 7;
int lightSwitch = 8;
int tempLed = 2;

//define variables to store moisture, light, and temperature values
int moisture_val;
int light_val;
int temp_val;

//decide how many hours of light your plants should get daily
float hours_light_daily_desired = 14;

//calculate desired hours of light total and supplemental daily based on above values
float proportion_to_light = hours_light_daily_desired / 24;
float seconds_light = 0;
float proportion_lit;

//setup a variable to store seconds since arduino switched on
float start_time;
float seconds_elapsed;
float seconds_elapsed_total;
float seconds_for_this_cycle;

void setup() {
//open serial port
Serial.begin(9600);
//set the water, light, and temperature pins as outputs that are turned off
pinMode (waterPump, OUTPUT);
pinMode (lightSwitch, OUTPUT);
pinMode (tempLed, OUTPUT);
digitalWrite (waterPump, LOW);
digitalWrite (lightSwitch, LOW);
digitalWrite (tempLed, LOW);

//establish start time
start_time = DateTime.now();
seconds_elapsed_total = 0;

}
void loop() {
// read the value from the moisture-sensing probes, print it to screen, and wait a second
moisture_val = analogRead(moistureSensor);
Serial.print("moisture sensor reads ");
Serial.println( moisture_val );
delay(1000);
// read the value from the photosensor, print it to screen, and wait a second
light_val = analogRead(lightSensor);
Serial.print("light sensor reads ");
Serial.println( light_val );
delay(1000);
// read the value from the temperature sensor, print it to screen, and wait a second
temp_val = analogRead(tempSensor);
Serial.print("temp sensor reads ");
Serial.println( temp_val );
delay(1000);
Serial.print("seconds total = ");
Serial.println( seconds_elapsed_total );
delay(1000);
Serial.print("seconds lit = ");
Serial.println( seconds_light);
delay(1000);
Serial.print("proportion desired = ");
Serial.println( proportion_to_light);
delay(1000);
Serial.print("proportion achieved = ");
Serial.println( proportion_lit);
delay(1000);

//turn water on when soil is dry, and delay until soil is wet
if (moisture_val < 850)
{
digitalWrite(waterPump, HIGH);
}

while (moisture_val < 850)
{
delay(10000);
}

digitalWrite(waterPump, LOW);

//update time, and increment seconds_light if the lights are on
seconds_for_this_cycle = DateTime.now() - seconds_elapsed_total;
seconds_elapsed_total = DateTime.now() - start_time;
if (light_val > 900)
{
seconds_light = seconds_light + seconds_for_this_cycle;
}

//cloudy days that get sunny again: turn lights back off if light_val exceeds 900. this works b/c the supplemental lights aren't as bright as the sun:)
if (light_val > 900)
{
digitalWrite (lightSwitch, LOW);
}

//turn off lights if proportion_lit>proportion_to_light, and then wait 5 minutes
if (proportion_lit > proportion_to_light)
{
digitalWrite (lightSwitch, LOW);
delay (300000);
}

//figure out what proportion of time lights have been on
proportion_lit = seconds_light/seconds_elapsed_total;

//turn lights on if light_val is less than 900 and plants have light for less than desired proportion of time, then wait 10 seconds
if (light_val < 900 and proportion_lit < proportion_to_light)
{
digitalWrite(lightSwitch, HIGH);
delay(10000);
}

//turn on temp alarm light if temp_val is less than 850 (approximately 50 degrees Fahrenheit)
if (temp_val < 850)
{
digitalWrite(tempLed, HIGH);
}

}

Unfortunately I keep getting error messages and I'm not sure how to clear them up. My error message is:

C:\Users\Dan\Documents\Arduino\libraries\DateTime\DateTime.cpp: In member function 'void DateTimeClass::setTime(time_t)':
C:\Users\Dan\Documents\Arduino\libraries\DateTime\DateTime.cpp:28: error: 'millis' was not declared in this scope
C:\Users\Dan\Documents\Arduino\libraries\DateTime\DateTime.cpp: In member function 'time_t DateTimeClass::now()':
C:\Users\Dan\Documents\Arduino\libraries\DateTime\DateTime.cpp:43: error: 'millis' was not declared in this scope

Not sure what I should be searching or how I go about solving this function. Would really love to skype or facetime with someone to figure this out. If you have a solution or could point me in the right direction I'd be very grateful.

Thanks!

Dan

I've solved my problem after taking a second look at a different post, since I can't delete my original post I'll repost the solution that worked for me:

To make this a little more clear for future users (because I just had this same problem):

First, you need to downloand and install the DateTime Library. The code is missing the <DateTime.h> tag if you pull your code from here: http://archive.makezine.com/18/garduino/

It should read: #include <DateTime.h>

Next, the DateTime.cpp file is wrong, you need to open that in notepad and change the <wiring.h> tag/attribute to <arduino.h>

After making those two changes your code should compile correctly.

That sounds as if the copy of the library you had predated the Arduino 1.0 changes and hadn't been brought up to date.

Yes, I believe that's why people are now running into problems when they try and follow the steps that were posted a few years ago. (Time flies!)