mirror of
https://github.com/sascha-hemi/pycom-documentation.git
synced 2026-03-21 09:04:12 +01:00
Pybytes mqtt conflict
This commit is contained in:
@@ -6,7 +6,7 @@ aliases:
|
||||
- chapter/tutorials/all/mqtt
|
||||
---
|
||||
|
||||
MQTT is a lightweight messaging protocol that is ideal for sending small packets of data to and from IoT devices via WiFi.
|
||||
MQTT is a lightweight messaging protocol that is ideal for sending small packets of data to and from IoT devices via WiFi. You will need to get the mqtt library file from our [Pycom libraries](https://github.com/pycom/pycom-libraries/tree/master/lib) repository on GitHub and place it in the `lib` folder of your project.
|
||||
|
||||
The broker used in this example is the [IO Adafruit](https://io.adafruit.com) platform, which is free and allows for tinkering with MQTT.
|
||||
|
||||
@@ -14,8 +14,11 @@ Visit [IO Adafruit](https://io.adafruit.com) and create an account. You'll need
|
||||
|
||||
This example will send a message to a topic on the Adafruit MQTT broker and then also subscribe to the same topic, in order to show how to use the subscribe functionality.
|
||||
|
||||
In the Pybytes library, we use mqtt as well. If you want to use a separate mqtt connection in conjunction with Pybytes, you will need to rename the `class MQTTCLient:` in the `mqtt.py` file to (for example) `class MQTTClient_lib:`, and import using the commented statement to avoid a naming conflict.
|
||||
|
||||
```python
|
||||
from mqtt import MQTTClient
|
||||
# from mqtt import MQTTClient_lib as MQTTClient
|
||||
from network import WLAN
|
||||
import machine
|
||||
import time
|
||||
|
||||
Reference in New Issue
Block a user