@@ -31,7 +31,64 @@ This is easily achieved by downloading
31
31
Usage Example
32
32
=============
33
33
34
- See examples/simple.py for a demonstration of parsing and printing GPS location.
34
+ See examples/gps_simpletest.py for a demonstration of parsing and printing GPS location.
35
+
36
+ Important:
37
+ Feather boards and many other circuitpython boards will round to two decimal places like this:
38
+
39
+ .. code-block :: python
40
+
41
+ >> > float (' 1234.5678' )
42
+ 1234.57
43
+
44
+ This isn't ideal for gps data as this lowers the accuracty from 0.1m to 11m.
45
+
46
+ This can be fixed by using string formatting when the gps data is outputted.
47
+
48
+ An implementation of this can be found in examples/gps_simpletest.py
49
+
50
+ .. code-block :: python
51
+
52
+ import time
53
+ import board
54
+ import busio
55
+
56
+ import adafruit_gps
57
+
58
+ RX = board.RX
59
+ TX = board.TX
60
+
61
+ uart = busio.UART(TX , RX , baudrate = 9600 , timeout = 30 )
62
+
63
+ gps = adafruit_gps.GPS(uart, debug = False )
64
+
65
+ gps.send_command(b ' PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0' )
66
+
67
+ gps.send_command(b ' PMTK220,1000' )
68
+
69
+ last_print = time.monotonic()
70
+ while True :
71
+
72
+ gps.update()
73
+
74
+ current = time.monotonic()
75
+ if current - last_print >= 1.0 :
76
+ last_print = current
77
+ if not gps.has_fix:
78
+ print (' Waiting for fix...' )
79
+ continue
80
+ print (' =' * 40 ) # Print a separator line.
81
+ print (' Latitude: {0:.6f } degrees' .format(gps.latitude))
82
+ print (' Longitude: {0:.6f } degrees' .format(gps.longitude))
83
+
84
+
85
+ These two lines are the lines that actually solve the issue:
86
+
87
+ .. code-block :: python
88
+
89
+ print (' Latitude: {0:.6f } degrees' .format(gps.latitude))
90
+ print (' Longitude: {0:.6f } degrees' .format(gps.longitude))
91
+
35
92
36
93
Contributing
37
94
============
@@ -85,4 +142,4 @@ Now, once you have the virtual environment activated:
85
142
86
143
This will output the documentation to ``docs/_build/html ``. Open the index.html in your browser to
87
144
view them. It will also (due to -W) error out on any warning like Travis will. This is a good way to
88
- locally verify it will pass.
145
+ locally verify it will pass.
0 commit comments