Last active
November 10, 2015 20:35
-
-
Save ampledata/433345814a119cada270 to your computer and use it in GitHub Desktop.
Threading APRS
This file contains 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
#!/usr/bin/env python | |
import threading | |
import aprs | |
class APRSMessage(object): | |
def __init__(self): | |
self.message = None | |
def set_message(self, message): | |
self.message = message | |
print "Received message: %s" % message | |
def message_timer(self): | |
if self.message is None: | |
print 'No message received!' | |
else: | |
self.message = None | |
am = APRSMessage() | |
ap = aprs.APRS('W2GMD', '12345') | |
at = threading.Timer(10.0, am.message_timer) | |
at.start() | |
ap.connect() | |
ap.receive(callback=am.set_message) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment