Skip to content

Instantly share code, notes, and snippets.

@Overdrivr
Created February 5, 2016 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Overdrivr/9a7582e4bd710b45e0e9 to your computer and use it in GitHub Desktop.
Save Overdrivr/9a7582e4bd710b45e0e9 to your computer and use it in GitHub Desktop.
Print received values from a telemetry-enabled serial connection using pytelemetry
import pytelemetry as tm
import pytelemetry.transports.serialtransport as transports
import time
def printer(topic, data):
print(topic," : ", data)
transport = transports.SerialTransport()
c = tm.pytelemetry(transport)
options = dict()
options['port'] = "COM20"
options['baudrate'] = 9600
transport.connect(options)
c.subscribe(None, printer)
timeout = time.time() + 3
while True:
c.update()
if time.time() > timeout:
break
transport.disconnect()
print("Done.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment