mqtt between esp8266 and arduino with PubSubclient
I am using ESP8266 with arduino using WiFiEsp library.I want to make MQTT connection with arduino so I use PubSubclient library.i got error: Attempting MQTT connection...failed, rc=-2 try again in 5 seconds my code is: #include <WiFiEsp.h> #include <WiFiEspClient.h> #include <WiFiEspUdp.h> #include "SoftwareSerial.h" #include <PubSubClient.h> IPAddress server(212, 72, 74, 21); char ssid[] = "atmel"; // your network SSID (name) char pass[] = "bets56789"; // your network password int status = WL_IDLE_STATUS; // the Wifi radio's status // Initialize the Ethernet client object WiFiEspClient