updated readAltitude() function