I am having trouble with serial communication. I want to send data from my Arduino to a touch screen. The data that I am sending will be obtained from the analogRead function.
My question is, analogRead is a 10bit number. If I do
Serial.write(analogRead(5));
and lets just assume that the value of analogRead(5) is 200...will it send 11001000, which is only 8 bits or will it send 0011001000, which is 10 bits?
Also if i say:
int val = analogRead(5);
Serial.write(val);
will it send 16 bits or will it only send the amount of bits necessary to describe the value?
I am asking about this because I will be sending a bunch of values from the arduino to the touch screen using analogRead and serial.write and if I know the arduino will send 10 bits for each sensor regardless of the value of the number then it will be easy to determine which bits belong to which sensor in the stream of data being sent.
If this is not the case the I guess I will have to send some kind of marker at the end of each sensor to separate them.
Thanks!