Created
May 29, 2017 19:50
-
-
Save roboticboyer/61e4e09526fd89287d63122d3a23b756 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
#!/usr/bin/python | |
import paho.mqtt.client as mqtt | |
import time | |
mqttc = mqtt.Client("python_pub") | |
#mqttc.connect("192.168.1.103", 1883) | |
mqttc.connect("192.168.4.1", 1883) | |
''' | |
Publish loop | |
''' | |
i=0 | |
while i<30: | |
mqttc.publish("temperatura", i) | |
print(i) | |
mqttc.loop(2) #timeout = 2s | |
i=i+1 | |
time.sleep(5) # delays for 5 seconds |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment