Last active
February 25, 2019 15:18
-
-
Save li2hub/908e9f663f47a7c0d4428395457bdcba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import paho.mqtt.client as paho | |
broker="192.168.xx.xxx" #IP of your Raspberry Pi | |
def on_message(client, userdata, message): | |
print("received message =",str(message.payload.decode("utf-8"))) | |
client= paho.Client("client-001") | |
client.on_message=on_message | |
print("connecting to broker ",broker) | |
client.connect(broker) | |
print("subscribing ") | |
client.subscribe("sensor_data") | |
client.loop_forever() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment