MQTT Basic


hi friends
i working on mqtt basic program since 2 days
//*******#have hardware connections below (executed server program 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 values suitable 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

# have loaded code arduino nano,
# publish / subscribe messages im getting problem:
(unable install wmqtt utility suggested blog )

this not make sense :

hi - i've bought stuff , don't know i'm building. teach me need know program pc , arduino, , tell me can do!

normally, idea, plan it, find hardware, write firmware, , if stuck or don't understand something, ask specific point.


Arduino Forum > Development > Other Software Development > MQTT Basic


arduino

Comments

Popular posts from this blog

opencv3, tbb and rasp pi 2 - Raspberry Pi Forums

small ethernet problem - Raspberry Pi Forums

Multithumb configuration params not working? - Joomla! Forum - community, help and support