Created
September 28, 2020 10:57
-
-
Save kareiva/8700d4ca9539c5eec1ff45e9c2f39ede 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 meshtastic | |
from pubsub import pub | |
def onReceive(packet): | |
print(f"Received: {packet}") | |
if ( packet['hopLimit'] > 0 and "decoded" in packet and | |
packet['decoded']['data']['typ'] == 'CLEAR_TEXT' ): | |
interface.sendText( | |
'SNR ' + str(packet['rxSnr']) + ': ' + packet['decoded']['data']['text']) | |
print(f"Sent beacon") | |
pub.subscribe(onReceive, "meshtastic.receive") | |
interface = meshtastic.StreamInterface("/dev/ttyUSB1") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment