mirror of
https://github.com/meshtastic/python.git
synced 2025-12-26 09:27:52 -05:00
24 lines
579 B
Python
24 lines
579 B
Python
"""Simple program to demo how to use meshtastic library.
|
|
To run: python examples/info.py
|
|
"""
|
|
|
|
import meshtastic
|
|
import meshtastic.serial_interface
|
|
|
|
iface = meshtastic.serial_interface.SerialInterface()
|
|
|
|
# call showInfo() just to ensure values are populated
|
|
# info = iface.showInfo()
|
|
|
|
if iface.myInfo:
|
|
# print(f'myInfo:{iface.myInfo}')
|
|
print(f"firmware_version:{iface.myInfo.firmware_version}")
|
|
|
|
if iface.nodes:
|
|
for n in iface.nodes.values():
|
|
if n["num"] == iface.myInfo.my_node_num:
|
|
print(n["user"]["hwModel"])
|
|
break
|
|
|
|
iface.close()
|