/* Basic MQTT example This sketch demonstrates the basic capabilities of the library. It connects to an MQTT server then: - publishes "hello world" to the topic "outTopic" - subscribes to the topic "inTopic", printing out any messages it receives. NB - it assumes the received payloads are strings not binary It will reconnect to the server if the connection is lost using a blocking reconnect function. See the 'mqtt_reconnect_nonblocking' example for how to achieve the same result without blocking the main loop. */ #include #include #include // Update these with values suitable for your network. byte mac[] = { 0xDE, 0xED, 0xBA, 0xFE, 0xFE, 0xED }; IPAddress ip(172, 16, 0, 100); IPAddress server(172, 16, 0, 2); void callback(char* topic, byte* payload, unsigned int length) { Serial.print("Message arrived ["); Serial.print(topic); Serial.print("] "); for (int i=0;i