Page 239 - Build Your Own Quadcopter_ Power Up Your Designs with the Parallax Elev-8
P. 239
218 Bu il d Y o ur O w n Q u a d c o p t e r
is streaming from the GPS PMB-688 module. The Spin object is named GPS_Propeller, and
the code is shown below.
{{
GPS_XBee
Modified !GPS_Propeller program by D. J. Norris 2013
This program controls an Elev-8 Quadcopter real-time data system
Pin connections:
Transmitter:
XBee DOUT to P7
XBee DIN to P6
GPS Data Out to P8
GPS Data In to P9
Receiver:
XBee DOUT to P7
XBee DIN to P6
}}
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
XB_Rx = 7 ‘ XBee DOUT
XB_Tx = 6 ‘ XBee DIN
XB_Baud = 9600
CR = 13 ‘ Carriage Return value
GPS_Pin = 8
OBJ
GPS : “GPS_Float_Lite”
FS : “FloatString”
xb1 : “XBee_Object_1”
Pub Start | fv
xb1.start(XB_Rx, XB_Tx, 0, XB_Baud) ‘ Initialize comms for XBee
xb1.AT_Init
xb1.AT_ConfigVal(string(“ATMY”),8) ‘ My XBee address is set to 8
xb1.AT_ConfigVal(string(“ATDL”),9) ‘ The remote XBee address is
set to 9
GPS.Init
repeat
xb1.Str(String(16, 1))
FS.SetPrecision(7)
fv := GPS.Float_Latitude_Deg ‘ Get latitude