Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CON
- _clkmode = xtal1 + pll16x
- _xinfreq = 5_000_000
- OBJ
- pst : "Parallax Serial Terminal"
- GPS : "GPS_Float_Lite"
- FS : "FloatString"
- text : "vga_text"
- Pub Main | Color, SentColor
- pst.Start(115_200)
- GPS.Init
- text.start(8)
- text.out(00)
- dira[0..4]~ 'Pins 0-4 to input
- waitcnt(clkfreq + cnt)
- Color := 5
- repeat
- if ina[0] == 0 'Down Black - Expectant
- Color := 0
- if ina[1] == 0 'Left Yellow - Delayed
- Color := 2
- if ina[2] == 0 'Center Send.
- SentColor := Color
- pst.Str(string("Color: "))
- pst.dec(SentColor)
- pst.char(32)
- Location
- pst.char(13)
- if ina[3] == 0 'Right Green - Minimal
- Color := 3
- if ina[4] == 0 'Up Red - Immediate
- Color := 1
- PUB Location | fv
- FS.SetPrecision(7)
- fv := GPS.Float_Latitude_Deg ' Get latitude
- If fv <> floatNaN
- pst.str(string("Latitude: "))
- pst.str(FS.FloatToString(fv))
- pst.char(32)
- Else
- pst.str(string("---"))
- fv := GPS.Float_Longitude_Deg ' Get longitude
- If fv <> floatNaN
- pst.str(string("Longitude: "))
- pst.str(FS.FloatToString(fv))
- pst.char(32)
- Else
- pst.str(string("---"))
- fv := GPS.Float_Altitude_Above_MSL ' Get altitude
- If fv <> floatNaN
- pst.str(string("Altitude: "))
- pst.str(FS.FloatToString(fv))
- pst.char(32)
- Else
- pst.str(string("---"))
- fv := GPS.Long_Hour ' Get Hour
- If fv <> floatNaN
- pst.str(string("The time is: "))
- pst.dec(GPS.Long_Hour)
- Else
- pst.str(string("---"))
- fv := GPS.Long_Minute ' Get Minute
- If fv <> floatNaN
- pst.dec(GPS.Long_Minute)
- Else
- pst.str(string("---"))
- WaitCnt(ClkFreq / 2 + ClkFreq / 4 + Cnt)
- DAT
- floatNaN LONG $7FFF_FFFF 'Means Not a Number
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement