repository to manage all files related to the makeathon farm bot project (Software + Documentation).
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

mqtt_publish1.py 345B

12345678910111213
  1. import paho.mqtt.client as mqtt
  2. import random
  3. import time
  4. mqttBroker = "mqtt.eclipseprojects.io"
  5. client = mqtt.Client("Temperature")
  6. client.connect(mqttBroker)
  7. while True:
  8. randNumber = random.randint(0, 20)
  9. client.publish("TEMPERATURE", randNumber)
  10. print("Published " + str(randNumber) + " to topic TEMPERATURE")
  11. time.sleep(2)