kopia lustrzana https://github.com/inmcm/micropyGPS
Add pyboard compatible test scripts
rodzic
145c0856d8
commit
083dae8095
|
@ -0,0 +1,26 @@
|
|||
# micropyGPS Sentence Test
|
||||
# When properly connected to working GPS module,
|
||||
# will print the names of the sentences it receives
|
||||
# If you are having issues receiving sentences, use UART_test.py to ensure
|
||||
# your UART is hooked up and configured correctly
|
||||
|
||||
from pyb import UART
|
||||
from micropyGPS import MicropyGPS
|
||||
|
||||
# Setup the connection to your GPS here
|
||||
# This example uses UART 3 with RX on pin Y10
|
||||
# Baudrate is 9600bps, with the standard 8 bits, 1 stop bit, no parity
|
||||
uart = UART(3, 9600)
|
||||
|
||||
# Instatntiate the micropyGPS object
|
||||
my_gps = MicropyGPS()
|
||||
|
||||
# Continuous Tests for characters available in the UART buffer, any characters are feed into the GPS
|
||||
# object. When enough char are feed to represent a whole, valid sentence, stat is set as the name of the
|
||||
# sentence and printed
|
||||
while True:
|
||||
if uart.any():
|
||||
stat = my_gps.update(chr(uart.readchar())) # Note the conversion to to chr, UART outputs ints normally
|
||||
if stat:
|
||||
print(stat)
|
||||
stat = None
|
|
@ -0,0 +1,29 @@
|
|||
from pyb import UART
|
||||
from micropyGPS import MicropyGPS
|
||||
|
||||
uart = UART(3, 9600)
|
||||
|
||||
# Basic UART --> terminal printer, use to test your GPS module
|
||||
# while True:
|
||||
# if uart.any():
|
||||
# print(chr(uart.readchar()), end='')
|
||||
|
||||
|
||||
my_gps = MicropyGPS()
|
||||
|
||||
sentence_count = 0
|
||||
while True:
|
||||
if uart.any():
|
||||
stat = my_gps.update(chr(uart.readchar()))
|
||||
if stat:
|
||||
print(stat)
|
||||
stat = None
|
||||
sentence_count += 1
|
||||
if sentence_count == 300:
|
||||
break;
|
||||
|
||||
|
||||
print('Sentences Found:', my_gps.clean_sentences)
|
||||
print('Sentences Parsed:', my_gps.parsed_sentences)
|
||||
print('CRC_Fails:', my_gps.crc_fails)
|
||||
|
Ładowanie…
Reference in New Issue