mirror of
https://github.com/meshtastic/meshtastic.git
synced 2024-12-28 23:19:47 -08:00
Merge pull request #772 from pdxlocations/using-python-library
Update python example
This commit is contained in:
commit
c715056e11
|
@ -20,14 +20,14 @@ interface = meshtastic.serial_interface.SerialInterface()
|
||||||
interface.sendText("hello mesh")
|
interface.sendText("hello mesh")
|
||||||
|
|
||||||
ourNode = interface.getNode('^local')
|
ourNode = interface.getNode('^local')
|
||||||
print(f'Our node preferences:{ourNode.radioConfig.preferences}')
|
print(f'Our node preferences:{ourNode.localConfig}')
|
||||||
|
|
||||||
# update a value
|
# update a value
|
||||||
print('Changing a preference...')
|
print('Changing a preference...')
|
||||||
ourNode.radioConfig.preferences.gps_update_interval = 60
|
ourNode.localConfig.position.gps_update_interval = 60
|
||||||
|
|
||||||
print(f'Our node preferences now:{ourNode.radioConfig.preferences}')
|
print(f'Our node preferences now:{ourNode.localConfig}')
|
||||||
ourNode.writeConfig()
|
ourNode.writeConfig("position")
|
||||||
|
|
||||||
interface.close()
|
interface.close()
|
||||||
```
|
```
|
||||||
|
@ -57,23 +57,7 @@ interface.close()
|
||||||
|
|
||||||
Note: Be sure to change the IP address in the code above to a valid IP address for your setup.
|
Note: Be sure to change the IP address in the code above to a valid IP address for your setup.
|
||||||
|
|
||||||
You can get and update settings like this:
|
For the rough notes/implementation plan see [TODO](https://github.com/meshtastic/python/blob/master/TODO.md). See the API for full details of how to use the library.
|
||||||
|
|
||||||
```python
|
|
||||||
import meshtastic
|
|
||||||
import meshtastic.serial_interface
|
|
||||||
interface = meshtastic.serial_interface.SerialInterface()
|
|
||||||
|
|
||||||
ourNode = interface.getNode('^local')
|
|
||||||
print(ourNode.radioConfig.preferences)
|
|
||||||
ourNode.radioConfig.preferences.gps_update_interval = 60
|
|
||||||
print(ourNode.radioConfig.preferences)
|
|
||||||
ourNode.writeConfig()
|
|
||||||
|
|
||||||
interface.close()
|
|
||||||
```
|
|
||||||
|
|
||||||
For the rough notes/implementation plan see [TODO](https://github.com/meshtastic/Meshtastic-python/blob/master/TODO). See the API for full details of how to use the library.
|
|
||||||
|
|
||||||
## A note to developers of this lib
|
## A note to developers of this lib
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue