Confusing Code in the Online Logger Shield Walkthrough

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
Clapton
 
Posts: 8
Joined: Wed Feb 22, 2012 11:23 pm

Confusing Code in the Online Logger Shield Walkthrough

Post by Clapton »

Greetings to Adafruit. Nice company. Nice products.

I noticed on your Logger Shield page that there is some confusing code in the "Light and Temperature Logger Walkthrough" located at:

http://www.ladyada.net/make/logshield/l ... kthru.html

Specifically, the code at the end of the setup section reads as follows:

logfile.println("millis,time,light,temp");
#if ECHO_TO_SERIAL
Serial.println("millis,time,light,temp");
#if ECHO_TO_SERIAL// attempt to write out the header to the file
if (logfile.writeError || !logfile.sync()) {
error("write header");
}

pinMode(redLEDpin, OUTPUT);
pinMode(greenLEDpin, OUTPUT);

// If you want to set the aref to something other than 5v
//analogReference(EXTERNAL);
}

Note that there are two #if statements and the setup section ends without the requisite #endif statements. I found a working version of this code in the Download section, so, as a newbie, my confusion was brief; but I thought I'd point it out. (Something else to add to the list, right?)

Best regards.

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: Confusing Code in the Online Logger Shield Walkthrough

Post by adafruit »

its a typo. just use the example code provided

Clapton
 
Posts: 8
Joined: Wed Feb 22, 2012 11:23 pm

Re: Confusing Code in the Online Logger Shield Walkthrough

Post by Clapton »

Okay, I understand. I'm just trying to get my bearings on what is helpful to others. Thank you.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”