Logging Acceleration Data to a Text File

Hi everyone, I'm very new to arduino and have had some trouble saving acceleration data to a text file on my desktop.

Firstly, I'm using an Arduino Uno and an AM3X accelerometer.
I have been attempting to use Gobetwino in order to log data automatically onto a text file. I have read through the Gobetwino instructions but as I'm new to Arduino coding, I'm having a lot of trouble putting the code together correctly.

My code is as follows:

#include <AcceleroMMA7361.h>

AcceleroMMA7361 accelero;
int x;
int y;
int z;
int serInLen = 25;
char serInString[25];
int logx = 0;
int logy = 0;
int logz = 0;


void setup()
{
 Serial.begin(9600);
 accelero.begin(13, 12, 11, 10, A0, A1, A2);
 accelero.setARefVoltage(3.3);                   //sets the AREF voltage to 3.3V
 //accelero.setSensitivity(LOW);                   //sets the sensitivity to +/-6G
 accelero.calibrate();
}

void loop()
{
 x = accelero.getXRaw();
 y = accelero.getYRaw();
 z = accelero.getZRaw();
 Serial.print("\nX: ");
 Serial.print(x);
 Serial.print("\tY: ");
 Serial.print(y);
 Serial.print("\tZ: ");
 Serial.print(z);
 logx= x;
 logy= y;
 logz= z;
 logData(logx,logy,logz); 

 delay(500);           //(make it readable)
}

void logData( int x, int y, int z) 
{
  char buffer[5];
 
  Serial.print("#S|LOGDATA|[");
   Serial.print(itoa((x), buffer, 10));
   Serial.print(";");
   Serial.print(itoa((y), buffer, 10));
   Serial.print(";");
   Serial.print(itoa((z), buffer, 10));
   Serial.println("]#");
  readSerialString(serInString,1000);
  // There ought to be a check here for a non 0 return value indicating an error and some error handeling
} 

//read a string from the serial and store it in an array
//you must supply the array variable - return if timeOut ms passes before the sting is read
void readSerialString (char *strArray,long timeOut) 
{
  long startTime=millis();
  int i;

  while (!Serial.available()) {
     if (millis()-startTime >= timeOut) {
        return;
     }
  }
  while (Serial.available() && i < serInLen) {
     strArray[i] = Serial.read();
     i++;
  }
}

I'm trying to save the acceleration data in all 3 axis, and my code is compiling, but nothing is saving to the text file. An issue with Gobetwino I am having is that I get this error on the Gobetwino screen.

2/12/2015 5:54:05 PM Serial port : COM4 opened at 9600 baud
2/12/2015 5:54:07 PM Commandstring recieved : 3
2/12/2015 5:54:07 PM The string recieved : 3 is not a well formed command string
2/12/2015 5:54:10 PM Commandstring recieved :
Calibrating MMA7361011..................................................
DONE
X: 510 Y: 511 Z: 759#S|LOGDATA|[510;511;759]#
2/12/2015 5:54:10 PM The string recieved :
Calibrating MMA7361011..................................................
DONE
X: 510 Y: 511 Z: 759#S|LOGDATA|[510;511;759]# is not a well formed command string
2/12/2015 5:54:12 PM Commandstring recieved :
X: 510 Y: 511 Z: 761#S|LOGDATA|[510;511;761]#
2/12/2015 5:54:12 PM The string recieved :
X: 510 Y: 511 Z: 761#S|LOGDATA|[510;511;761]# is not a well formed command string

If anyone has any suggestions it would be greatly appreciated!

Thanks and kind regards,

Jackson Booth

I've deleted the duplicate of this topic.

DO NOT CROSS-POST, CROSS-POSTING WASTES TIME.

You are printing X,Y,Z to Serial and then you immediately print the |LOGDATA| command to Serial too!

The error message says that it doesn't understand this command because it's got extra stuff in front of the command.

Don't print that extra stuff first and it will probably work.

MorganS:
You are printing X,Y,Z to Serial and then you immediately print the |LOGDATA| command to Serial too!

The error message says that it doesn't understand this command because it's got extra stuff in front of the command.

Don't print that extra stuff first and it will probably work.

Thanks so much MorganS!
I don't understand the code as I'm very new, but I tried to put it together going off of examples, who knew something so simple would fix it.

I now am able to save the data automatically to a text file with no issues