fix examples

This commit is contained in:
geeksville
2020-04-28 17:14:28 -07:00
parent 219838ffd0
commit d9afd1e750
3 changed files with 12 additions and 9 deletions

View File

@@ -15,7 +15,7 @@ then run the following python3 code:
```
import meshtastic
interface = meshtastic.StreamInterface() # By default will try to find a meshtastic device, otherwise provide a device path like /dev/ttyUSB0
interface.sendData("hello world")
interface.sendData("hello mesh")
```
For the rough notes/implementation plan see [TODO](https://github.com/meshtastic/Meshtastic-python/blob/master/TODO.md).

View File

@@ -22,7 +22,7 @@
<section id="section-intro">
<h2 id="an-api-for-meshtastic-devices">an API for Meshtastic devices</h2>
<p>Primary class: StreamInterface
Install with pip: "pip3 install meshtastic"
Install with pip: "<a href="https://pypi.org/project/meshtastic/">pip3 install meshtastic</a>"
Source code on <a href="https://github.com/meshtastic/Meshtastic-python">github</a></p>
<p>properties of StreamInterface:</p>
<ul>
@@ -56,11 +56,12 @@ def onReceive(packet): # called when a packet arrives
print(f&quot;Received: {packet}&quot;)
def onConnection(): # called when we (re)connect to the radio
interface.sendData(&quot;hello world&quot;) # defaults to broadcast, specify a destination ID if you wish
interface.sendText(&quot;hello mesh&quot;) # defaults to broadcast, specify a destination ID if you wish
interface = meshtastic.StreamInterface() # By default will try to find a meshtastic device, otherwise provide a device path like /dev/ttyUSB0
pub.subscribe(onReceive, &quot;meshtastic.receive&quot;)
pub.subscribe(onConnection, &quot;meshtastic.connection.established&quot;)
interface = meshtastic.StreamInterface() # By default will try to find a meshtastic device, otherwise provide a device path like /dev/ttyUSB0
</code></pre>
<details class="source">
<summary>
@@ -70,7 +71,7 @@ pub.subscribe(onConnection, &quot;meshtastic.connection.established&quot;)
## an API for Meshtastic devices
Primary class: StreamInterface
Install with pip: &#34;pip3 install meshtastic&#34;
Install with pip: &#34;[pip3 install meshtastic](https://pypi.org/project/meshtastic/)&#34;
Source code on [github](https://github.com/meshtastic/Meshtastic-python)
properties of StreamInterface:
@@ -103,11 +104,12 @@ def onReceive(packet): # called when a packet arrives
print(f&#34;Received: {packet}&#34;)
def onConnection(): # called when we (re)connect to the radio
interface.sendData(&#34;hello world&#34;) # defaults to broadcast, specify a destination ID if you wish
interface.sendText(&#34;hello mesh&#34;) # defaults to broadcast, specify a destination ID if you wish
interface = meshtastic.StreamInterface() # By default will try to find a meshtastic device, otherwise provide a device path like /dev/ttyUSB0
pub.subscribe(onReceive, &#34;meshtastic.receive&#34;)
pub.subscribe(onConnection, &#34;meshtastic.connection.established&#34;)
interface = meshtastic.StreamInterface() # By default will try to find a meshtastic device, otherwise provide a device path like /dev/ttyUSB0
```
&#34;&#34;&#34;

View File

@@ -35,11 +35,12 @@ def onReceive(packet): # called when a packet arrives
print(f"Received: {packet}")
def onConnection(): # called when we (re)connect to the radio
interface.sendData("hello world") # defaults to broadcast, specify a destination ID if you wish
interface.sendText("hello mesh") # defaults to broadcast, specify a destination ID if you wish
interface = meshtastic.StreamInterface() # By default will try to find a meshtastic device, otherwise provide a device path like /dev/ttyUSB0
pub.subscribe(onReceive, "meshtastic.receive")
pub.subscribe(onConnection, "meshtastic.connection.established")
interface = meshtastic.StreamInterface() # By default will try to find a meshtastic device, otherwise provide a device path like /dev/ttyUSB0
```
"""