The trick is to make packets of data, a packet starts with a start byte, then an identifier then the value and then a stop byte, optionally there is a crc code for error detection.
think of it as < P = B B B B >
So sending the altitude becomes :
void writeAltitude(float val)
{
writeField('A', val);
}
void writeTemperature(float val)
{
writeField('T', val);
}
void writeField(char ID, float val)
{
Serial.print('<'); // start byte
Serial.print(ID); ID
Serial.write (&val, sizeof (val));
Serial.print(">"); // stop byte
}
On the receiving site you must unpack the data again of course