Hi friends
I am working on MQTT basic program since two days
//*******#have hardware with connections as below (executed server program successfully with same connections)
|PC| <--USB cable-->|Arduino Nano|<--(jumper wires)-->|ENC28J60 shield|<--Ethernet Cable-->|Ethernet Switch|
PC IP: 192.168.0.114 / windows
//**********#software
#include <SPI.h>
#include <Ethernet.h>
#include <PubSubClient.h>
// Update these with values suitable for your network.
byte mac[] = { 0xDE, 0xED, 0xBA, 0xFE, 0xFE, 0xED };
byte server[] = { 192, 168, 0, 110 };
byte ip[] = { 192, 168, 0, 222 };
void callback(char* topic, byte* payload, unsigned int length) {
// handle message arrived
}
EthernetClient ethClient;
PubSubClient client(server, 1883, callback, ethClient);
void setup()
{
Ethernet.begin(mac, ip);
if (client.connect("arduinoClient")) {
client.publish("outTopic","hello world");
client.subscribe("inTopic");
}
}
void loop()
{
client.loop();
}
//*********Code ends
I have loaded the code into Arduino Nano,
to publish / subscribe the messages im getting the problem:
(unable to install WMQTT utility which was suggested by blog )