Last active
August 29, 2015 14:03
-
-
Save murilopontes/8a7684ea599bf0703665 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import threading | |
import time | |
from gps import * | |
class GpsPoller(threading.Thread): | |
def __init__(self): | |
threading.Thread.__init__(self) | |
self.session = gps(mode=WATCH_ENABLE) | |
def get_s(self): | |
return self.session | |
def run(self): | |
while True: | |
try: | |
self.session.next() | |
except: | |
pass | |
if __name__ == '__main__': | |
gpsp = GpsPoller() | |
gpsp.start() | |
while 1: | |
time.sleep(1) | |
print gpsp.get_s() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment