def gpsLoop(r2p, loop_time): gps = GPS.GPSData() gps.open_port('/dev/ttyUSB', range(4), 19200) desLatitude = -38.1978504384 desLongitude = 144.2991186111 while True: now = time.time() try: doGPS(r2p, gps) print "------------------------------------GPS LOCK----------------------------------------" except Exception, e: print "GPS not locked", e finally:
import GPS import RPi.GPIO as GPIO import time gps = GPS.GPS() #gps.turnOn() GPSdata = GPS.GPSData() print("start GPS read") while True: gps.readGPS()