Starting over

:)Dear Arduino forum, After my laptop crashed and too many “avrdude” errors in my Xbee work, I bought a new HP laptop, new Xbees, shields and explorer/adapters, starting all over with Sparkfun tutorials (I see they have a way for getting around the mysterious “avrdude” error, although something for this is in the Adafruit tutorials). I downloaded Arduino 1.01, installed it and moved “Documents>Arduino” to my new laptop, intending to use my UNOs to set up Xbee communication. Can you help with one question? 1) The 1.01 IDE files>sketchbook didn’t see the Doc>Arduino pdr files, but I could go to Files>sketch>add and call in a file from Doc>Arduino. It compiled OK. Impulsively, I moved files from Doc>Arduino to the sketch folder, thinking they would be available to 1.01 IDE. NOT. Now I find I can’t move the files back to Doc>Arduino so that they are available to IDE. Also, when I activate 1.01 IDE, it says the sketchbook is lost. How can I restore Doc>Arduino or get files into a useful sketch folder?

Run the Arduino IDE, go to File -> Preferences and then near the bottom there should be a "preferences.txt" file, click it and it will open that file.

Do a find for the following search words:


Mine looks like this:


Dear Forum,
I don’t know how to navigate this Forum yet for posting to the last person that helped me. Also, I don’t know how to abort this post, since it’s to the wrong person, who requested that I enter the code into “Programming”. This sketch is a stab at sending motion sensor data from a Xbee on a lily pad remote to a SD card on a datalogger shield (Adafruit kit) atop a Xbee shield atop a UNO R3 (“base”). Only “0” or “1” is sent, depending on whether the sensor is low or high, respectively.
My questions are: 1) How does the data from the remote get to the SD card as dataFile? :sweat_smile:It has to arrive first as “mySerial”, but how would “mySerial” get into “dataFile”? 2) Maybe I need UNOs on both ends, because the program sending the data is on the “base” :astonished:.
Later, I’ll switch from a PIR to a HRLV-MaxSonar-EZ4 that will send timed data only if a distance is penetrated. There would be no “else” in this program. Cheers and thanks again.

 * Xbee wireless PIR sensor to datalogger with Arduino 1.0.1
 #include <SD.h>
 #include <SoftwareSerial.h>
 SoftwareSerial mySerial = SoftwareSerial(0,1);
 const int chipSelect = 10;
unsigned long time;        //Note--time will be changed to RTC later
const int ledPin = 8;                // choose the pin for the LED
const int inputPin = 7;               // choose the input pin (for PIR sensor)
int pirState = LOW;             // we start, assuming no motion detected
void setup() 
  pinMode(ledPin, OUTPUT);      // declare LED as output
  pinMode(inputPin, INPUT);     // declare sensor as input
  Serial.print("Initializing SD Card...");
  if (!SD.begin(chipSelect)) {
    Serial.println("Card failed, or not present");
 Serial.println("card initialized");
 Serial.print("Goodnight Moon");
 mySerial.println("Hello World");
void loop()
  float time = millis();
  pirState = digitalRead(inputPin);  // read input value
    if (pirState == HIGH) {         // check if the input is HIGH
    digitalWrite(ledPin, HIGH);    //LED on
    delay (500);
    digitalWrite(ledPin, LOW);     //LED OFF
   File dataFile ="datalog.txt", FILE_WRITE);
    do {                                                                    // Just a "while" loop would be OK, but see below
     Serial.print(" ");     // this Serial print is just temporary to check on the serial monitor
      Serial.print(",  "); 
      Serial.println("1");;        // Why here?  Is it here to set up the next "do-while"?              
    while (mySerial.available()==0);        // Idon't understand: for the same reason above 
    do {    
     mySerial.print (" ");
     mySerial.print(", ");
     while (Serial.available()==0); 
    do {
    dataFile.print (", ");
    dataFile.println('1');;            //would this work?
    while (mySerial.available()==0);                         // Wouldn't this be "while (dataFile.available()); ??
    }                             //Closes "if" statement
 else {
    do {                         //omitted Serial.pring list
      mySerial.print(" ");
      mySerial.print(" ");
      while (Serial.available()==0);
    do {
      dataFile.print(" ");
      dataFile.print(" ");
      dataFile.println("0");;          //again, will this work?
     while mySerial.available()==0);   //would this work?
    }                          //Closes "else" statwement           
     if (pirState == HIGH) { 
      // We only want to print on the output change, not state
      pirState = LOW;
                                //Closes loop

Are you saying you want Reply #2 (the one above) split off and moved to the Programming section?