Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- OBJ
- pst : "parallax serial terminal"
- alt : "29124_altimeter"
- CON
- _clkmode = xtal1 + pll16x
- _xinfreq = 5_000_000
- START_ALT = 1317 ' Your starting altitude in feet. You can get this from a local airport
- PUB start | a, p, t
- pst.start(38400) ' Start Parallax serial terminal.
- alt.start(alt#QUICKSTART, alt#BACKGROUND) ' Start altimeter for QuickStart with background processing.
- alt.set_resolution(alt#HIGHEST) ' Set to highest resolution.
- alt.set_altitude(alt.m_from_ft(START_ALT * 100)) ' Set the starting altitude, based on average local pressure.
- repeat
- a := alt.altitude(alt.average_press) ' Get the current altitude in cm, from new average local pressure.
- pst.str(string(pst#HM, "Altitude:")) ' Print header. HM = home
- pst.str(alt.formatn(a, alt#METERS | alt#CECR, 8)) ' Print altitude in meters, clear-to-end, and CR.
- pst.str(alt.formatn(a, alt#TO_FEET | alt#CECR, 18)) ' Print altitude in feet, clear-to-end, and CR.
- p := alt.current_press
- pst.str(string("Barometric Pressure:"))
- pst.str(alt.formatn(p, alt#MILLIBARS | alt#CECR, 8))
- pst.str(alt.formatn(p, alt#TO_INCHES | alt#CECR, 27))
- t := alt.current_temp
- pst.str(string("Temperature:"))
- pst.str(alt.formatn(t, alt#DEGC | alt#CECR, 8))
- pst.str(alt.formatn(t, alt#TO_DEGF | alt#CECR, 20))
- if (pst.rxcount) ' Respond to any key by clearing screen.
- pst.rxflush
- pst.char(pst#CS)
Advertisement
Add Comment
Please, Sign In to add comment