SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
#131772
Good Day,

I'm trying to put data being recieved from a 9DOF sensor (http://www.sparkfun.com/products/9623) thru a serial connection to a Arduino Mega 2560 into a variable so I can later write it to an SD Card.

The following code is contained in the void loop() {

Code: Select all
  if(Serial1.available() > 0)
    Serial.print(Serial1.read(), BYTE);
How would I break up Serial.print(Serial1.read(), BYTE); so I can assign the data in (Serial1.read(), BYTE) to a string variable?

Looking for something on the lines of

Code: Select all
  if(Serial1.available() > 0)
    strData = (Serial1.read(), BYTE);
    Serial.print(strData)
But this does not reproduce the same results as
Code: Select all
  if(Serial1.available() > 0)
    Serial.print(Serial1.read(), BYTE);
Any help with this would be appreciated.

Thanks
Don Anderson