File: hello_world_serial.py

package info (click to toggle)
meshtastic 2.7.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,604 kB
  • sloc: python: 10,771; sh: 76; makefile: 33
file content (19 lines) | stat: -rw-r--r-- 477 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"""Simple program to demo how to use meshtastic library.
   To run: python examples/hello_world_serial.py
"""

import sys

import meshtastic
import meshtastic.serial_interface

# simple arg check
if len(sys.argv) < 2:
    print(f"usage: {sys.argv[0]} message")
    sys.exit(3)

# By default will try to find a meshtastic device,
# otherwise provide a device path like /dev/ttyUSB0
iface = meshtastic.serial_interface.SerialInterface()
iface.sendText(sys.argv[1])
iface.close()