user57691: I have an Arduino Uno and an Adafruit data logging shield and I have connected a digital pressure sensor that uses serial communication. The sensor requires a character to start transmitting data. I have managed to read the data using this code:
#include <SoftwareSerial.h> 
SoftwareSerial mySerial(8,9); 

int depth;

void setup() {

    Serial.begin(9600);
    mySerial.begin(9600);
    mySerial.print("C");

}

void loop() 
{

 if (mySerial.available()) {

   depth = mySerial.read();

 }

}

This returns the following:

C1000
  C1000
  C1000

where 1000 is the value. 
I have written another code that logs data to the shield and tested with other sensors but I cannot log data from this sensor by modifying the above code and cannot find any relevant examples.
If I add something like this it does not return the same value.  
logfile.println(depth);

Complete newbie in so any suggestions are welcome.
UPDATE


user37622: use the C as the line start indicator. if received char is 'C' then do a file.println(); example with output to Serial
#include <SoftwareSerial.h> 
SoftwareSerial mySerial(8,9); 

void setup() {
    Serial.begin(9600);
    mySerial.begin(9600);
    mySerial.print("C");
}

void loop() {
 if (mySerial.available()) {
   char c = mySerial.read();
   if (c == 'C') {
     Serial.println();
   }
   Serial.write(c);
 }
}


57691: <p>I have an Arduino Uno and an Adafruit data logging shield and I have connected a digital pressure sensor that uses serial communication. The sensor requires a character to start transmitting data. I have managed to read the data using this code:</p>

<pre><code>#include &lt;SoftwareSerial.h&gt; 
SoftwareSerial mySerial(8,9); 

int depth;

void setup() {

    Serial.begin(9600);
    mySerial.begin(9600);
    mySerial.print("C");

}

void loop() 
{

 if (mySerial.available()) {

   depth = mySerial.read();

 }

}
</code></pre>

<p>This returns the following:</p>

<blockquote>
  <p>C1000<br>
  C1000<br>
  C1000</p>
</blockquote>

<p>where 1000 is the value. </p>

<p>I have written another code that logs data to the shield and tested with other sensors but I cannot log data from this sensor by modifying the above code and cannot find any relevant examples.
If I add something like this it does not return the same value.  </p>

<pre><code>logfile.println(depth);
</code></pre>

<p>Complete newbie in so any suggestions are welcome.</p>

<p>UPDATE</p>

<p><a href="https://i.stack.imgur.com/0FvDt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0FvDt.png" alt="enter image description here"></a></p>
 37622: <p>use the C as the line start indicator. if received char is 'C' then do a <code>file.println();</code> example with output to Serial</p>

<pre><code>#include &lt;SoftwareSerial.h&gt; 
SoftwareSerial mySerial(8,9); 

void setup() {
    Serial.begin(9600);
    mySerial.begin(9600);
    mySerial.print("C");
}

void loop() {
 if (mySerial.available()) {
   char c = mySerial.read();
   if (c == 'C') {
     Serial.println();
   }
   Serial.write(c);
 }
}
</code></pre>
