Data in 2 bytes little endian

Hi.

I have a Arduino serial.print in ASCII (only integers) from a ADC, but i wish to save the data to a file in 2 bytes little endian. How can i convert one integer to 2 bytes little endian?

Best regards.

You convert the integer into two bytes using lowByte() and highByte(). Little endian vs. big endian is a matter of which byte you write (to the file) first.

Thanks for pointing out the references :)

It was much more simple than i thought:

int value = ADC_ext.readSigned(2); //read from the ADC.
Serial.write(lowByte(value)); 
Serial.write(highByte(value));