from machine import UART, Pin
from time import sleep
from micropyGPS import MicropyGPS
my_gps = MicropyGPS(9)
gps_serial = UART(1, baudrate=9600, tx=Pin(4), rx=Pin(5))
while True:
if gps_serial.any():
data = gps_serial.read()
for byte in data:
stat = my_gps.update(chr(byte))
if stat:
# 속도 정보 가져오기 (kph: 킬로미터/시간)
speed = my_gps.speed_string('kph')
# 위성이 3개 이상 잡혀야 정확도가 생김
satellites = my_gps.satellites_in_use
print(f"현재 속도: {speed} km/h")
print(f"연결된 위성 수: {satellites}")
print("-" * 15)