VN200 Sensor with Arduino

I'm working on cool project with a VN200 Sensor and the Intel Edison with Arduino Breakout Board. I'm reading data from the VN and storing it on an SD card. Interestingly enough, the data being written to the card is slightly different from the data that I chose to output on the serial monitor for debugging purposes.

Below is the relevant portion of my code:

serav2 = Serial1.available(); //Serial1 is the VN sensor, datafile is the file on the SD card
if(serav2>0)
{
for(int i=0;i<serav2;i++)
{
char serial1 = char(Serial1.read());
dataFile.write(serial1);
Serial.print(serial1);
}
}

Does it matter if I use dataFile.write() vs. dataFile.print()? I've found that dataFile.write() matches better with the Serial output. Also, should I change the variable type from char to unsigned char or something? I feel like char should be the right data type.

Based on this code, shouldn't the SD card file have the same data values as the Serial monitor? Also, does anyone have experience with the VN sensor?

Another problem I've been having is that I can't get the board to run properly off of external power. It runs fine with the two micro-USB ports connected to my laptop, but once I switch to the barrel jack connected to a 9V battery, the board either 1) works as expected, 2) doesn't create a file, 3) creates a file but doesn't write anything to it, resulting in an empty file. I tried flashing the older 146 firmware version, but it didn't solve the problem. Does anyone have experience with Intel Edison acting inconsistently off of external power?

Any help would be greatly appreciated!

Please read the "How to use this forum" post and follow the directions. Post the code, properly, along with examples of the problem.

The small, rectangular 9V batteries are for smoke alarms, and often don't work well or at all with Arduino.