import time import board import busio import math import neopixel import adafruit_gps cadena = neopixel.NeoPixel(board.D8, 10) uart = busio.UART(board.TX, board.RX, baudrate=9600, timeout=100) gps = adafruit_gps.GPS(uart) cf = b'PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0' gps.send_command(cf) gps.send_command(b'PMTK220,1000') cLt = 41.384033 cLg = 2.115993 a = 0.002 b = 0.003 anterior = time.monotonic() while True: gps.update() actual = time.monotonic() if (actual - anterior) >= 1.0: anterior = actual if not gps.has_fix: print('Esperando...') else: Lt = gps.latitude Lg = gps.longitude dLt = math.fabs(Lt - cLt) dLg = math.fabs(Lg - cLg) cadena[0] = (0, 255, 0) if (dLt > a) or (dLg > a): cadena[0] = (255, 255, 0) if (dLt > b) or (dLg > b): cadena[0] = (255, 0, 0)