@@ -0,0 +1,1786 @@
+#! /usr/bin/python%0A# Based on%0A# Written by Dan Mandle http://dan.mandle.me September 2012%0A# License: GPL 2.0%0A%0Aimport os%0Afrom gps import *%0Afrom time import *%0Aimport time%0Aimport threading%0Aimport json%0Aimport paho.mqtt.client as paho%0A%0Agpsd = None %0A%0Aclass GpsPoller(threading.Thread):%0A  def __init__(self):%0A    threading.Thread.__init__(self)%0A    global gpsd #bring it in scope%0A    gpsd = gps(mode=WATCH_ENABLE) #starting the stream of info%0A    self.current_value = None%0A    self.running = True #setting the thread running to true%0A%0A  def run(self):%0A    global gpsd%0A    while gpsp.running:%0A      gpsd.next() #this will continue to loop and grab EACH set of gpsd info to clear the buffer%0A%0Aif __name__ == '__main__':%0A  gpsp = GpsPoller() # create the thread%0A  try:%0A    gpsp.start() # start it up%0A    while True:%0A      if gpsd.fix.latitude %3E 0:%0A        row = %5B %7B 'latitude': str(gpsd.fix.latitude),%0A         'longitude': str(gpsd.fix.longitude),%0A         'utc': str(gpsd.utc),%0A         'time':   str(gpsd.fix.time),%0A         'altitude': str(gpsd.fix.altitude),%0A         'eps': str(gpsd.fix.eps),%0A         'epx': str(gpsd.fix.epx),%0A         'epv': str(gpsd.fix.epv),%0A         'ept': str(gpsd.fix.ept),%0A         'speed': str(gpsd.fix.speed),%0A         'climb': str(gpsd.fix.climb),%0A         'track': str(gpsd.fix.track),%0A         'mode': str(gpsd.fix.mode)%7D %5D%0A%0A        json_string = json.dumps(row)%0A        client = paho.Client()%0A        client.username_pw_set(%22jrfcwrim%22,%22UhBGemEoqf0D%22)%0A        client.connect(%22m13.cloudmqtt.com%22, 14162, 60)%0A        client.publish(%22rpiwzgps%22, payload=json_string, qos=0, retain=True)%0A%0A        time.sleep(60)%0A%0A  except (KeyboardInterrupt, SystemExit): #when you press ctrl+c%0A    gpsp.running = False%0A    gpsp.join() # wait for the thread to finish what it's doing%0A

Create gps2.py