MQTT connection failing, serial monitor returns -2 in arduino ide





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I m trying to send the dht22 temperature and humidity data to cloud mqtt.
I m using ESP8266 as wifi module to send the data from the arduino uno to the server.
The libraries i m using are : wifiesp, Pubsubclient and dht
The problem i m facing is that the connection to the mqtt server gets failed and returns -2 on serial monitor, sometimes i face data packet send error(2) and socket error.
this is my first question on stackoverflow, so sorry for any error i made.



My code is:



#include "DHT.h"
#include <WiFiEspClient.h>
#include <WiFiEsp.h>
#include <WiFiEspUdp.h>
#include <PubSubClient.h>
#include "SoftwareSerial.h"

#define WIFI_AP "ssid"
#define WIFI_PASSWORD "password"

#define TOKEN "mqttusername"
#define PASS "mqttpassword"

// DHT
#define DHTPIN 5
#define DHTTYPE DHT22

char mqttServer = "m15.cloudmqtt.com";

// Initialize the Ethernet client object
WiFiEspClient espClient;

// Initialize DHT sensor.
DHT dht(DHTPIN, DHTTYPE);

PubSubClient client(espClient);

SoftwareSerial Serial1(10,11); // RX, TX

int status = WL_IDLE_STATUS;
unsigned long lastSend;

void setup() {
// initialize serial for debugging
Serial.begin(115200);

dht.begin();
InitWiFi();
client.setServer( mqttServer, 17094 );
lastSend = 0;
}

void loop() {
//status = WiFi.status();

if ( !client.connected() ) {
reconnect();
}

if ( millis() - lastSend > 1000 ) { // Update and send only after 1 seconds
getAndSendTemperatureAndHumidityData();
lastSend = millis();
}

client.loop();
}

void getAndSendTemperatureAndHumidityData()
{
Serial.println("Collecting temperature data.");

// Reading temperature or humidity takes about 250 milliseconds!
float h = dht.readHumidity();
// Read temperature as Celsius (the default)
float t = dht.readTemperature();

// Check if any reads failed and exit early (to try again).
if (isnan(h) || isnan(t)) {
Serial.println("Failed to read from DHT sensor!");
return;
}

Serial.print("Humidity: ");
Serial.print(h);
Serial.print(" %t");
Serial.print("Temperature: ");
Serial.print(t);
Serial.print(" *C ");

String temperature = String(t);
String humidity = String(h);


// Just debug messages
Serial.print( "Sending temperature and humidity : [" );
Serial.print( temperature ); Serial.print( "," );
Serial.print( humidity );
Serial.print( "] -> " );

// Prepare a JSON payload string
String payload = "{";
payload += ""temperature":"; payload += temperature; payload += ",";
payload += ""humidity":"; payload += humidity;
payload += "}";

// Send payload
char attributes[100];
payload.toCharArray( attributes, 100 );
client.publish( "esp8266/dht22", attributes );
Serial.println( attributes );
}

void InitWiFi()
{
// initialize serial for ESP module
Serial1.begin(115200);
// initialize ESP module
WiFi.init(&Serial1);

// check for the presence of the shield
if (WiFi.status() == WL_NO_SHIELD) {
Serial.println("WiFi shield not present");
// don't continue
while (false);
}

// attempt to connect to WiFi network
while ( status != WL_CONNECTED) {
Serial.print("Attempting to connect to WPA SSID: ");
// print the SSID of the network you're attached to
//Serial.print("SSID: ");
Serial.println(WiFi.SSID());
// Connect to WPA/WPA2 network
status = WiFi.begin(WIFI_AP, WIFI_PASSWORD);
}
}

void reconnect() {
// Loop until we're reconnected
while (!client.connected()) {
Serial.print("Connecting to CLOUD MQTT ...");
// Attempt to connect (clientId, username, password)
if ( client.connect("Arduino Uno Device", TOKEN, PASS) ) {
Serial.println( "[DONE]" );
} else {
Serial.print( "[FAILED] [ rc = " );
Serial.print( client.state() );
Serial.println( " : retrying in 5 seconds]" );
// Wait 5 seconds before retrying
delay( 5000 );
}
}
}


The error I m getting are:serial monitor on arduino ide



The cloud mqtt log says



2019-01-04 10:51:28: Socket error on client Arduino Uno Device, disconnecting.
2019-01-04 10:51:48: New connection from 103.215.241.176 on port 17094.
2019-01-04 10:51:48: New client connected from 103.215.241.176 as Arduino Uno Device (c1, k15, u'ihiiwona').
2019-01-04 10:51:48: No will message specified.
2019-01-04 10:51:48: Sending CONNACK to Arduino Uno Device (0, 0)
2019-01-04 10:52:11: Client Arduino Uno Device has exceeded timeout, disconnecting.
2019-01-04 10:52:11: Socket error on client Arduino Uno Device, disconnecting.
2019-01-04 10:52:14: New connection from 103.215.241.176 on port 17094.
2019-01-04 10:52:14: New client connected from 103.215.241.176 as Arduino Uno Device (c1, k15, u'ihiiwona').
2019-01-04 10:52:14: No will message specified.
2019-01-04 10:52:14: Sending CONNACK to Arduino Uno Device (0, 0)
2019-01-04 10:52:26: Received PINGREQ from MQTT_FX_Client
2019-01-04 10:52:26: Sending PINGRESP to MQTT_FX_Client
2019-01-04 10:52:36: Client Arduino Uno Device has exceeded timeout, disconnecting.
2019-01-04 10:52:36: Socket error on client Arduino Uno Device, disconnecting.
2019-01-04 10:52:40: New connection from 103.215.241.176 on port 17094.
2019-01-04 10:53:26: Received PINGREQ from MQTT_FX_Client
2019-01-04 10:53:26: Sending PINGRESP to MQTT_FX_Client
2019-01-04 10:54:11: Client <unknown> has exceeded timeout, disconnecting.
2019-01-04 10:54:11: Socket error on client <unknown>, disconnecting.


Please someone help and tell me what i m doing wrong.










share|improve this question





























    0















    I m trying to send the dht22 temperature and humidity data to cloud mqtt.
    I m using ESP8266 as wifi module to send the data from the arduino uno to the server.
    The libraries i m using are : wifiesp, Pubsubclient and dht
    The problem i m facing is that the connection to the mqtt server gets failed and returns -2 on serial monitor, sometimes i face data packet send error(2) and socket error.
    this is my first question on stackoverflow, so sorry for any error i made.



    My code is:



    #include "DHT.h"
    #include <WiFiEspClient.h>
    #include <WiFiEsp.h>
    #include <WiFiEspUdp.h>
    #include <PubSubClient.h>
    #include "SoftwareSerial.h"

    #define WIFI_AP "ssid"
    #define WIFI_PASSWORD "password"

    #define TOKEN "mqttusername"
    #define PASS "mqttpassword"

    // DHT
    #define DHTPIN 5
    #define DHTTYPE DHT22

    char mqttServer = "m15.cloudmqtt.com";

    // Initialize the Ethernet client object
    WiFiEspClient espClient;

    // Initialize DHT sensor.
    DHT dht(DHTPIN, DHTTYPE);

    PubSubClient client(espClient);

    SoftwareSerial Serial1(10,11); // RX, TX

    int status = WL_IDLE_STATUS;
    unsigned long lastSend;

    void setup() {
    // initialize serial for debugging
    Serial.begin(115200);

    dht.begin();
    InitWiFi();
    client.setServer( mqttServer, 17094 );
    lastSend = 0;
    }

    void loop() {
    //status = WiFi.status();

    if ( !client.connected() ) {
    reconnect();
    }

    if ( millis() - lastSend > 1000 ) { // Update and send only after 1 seconds
    getAndSendTemperatureAndHumidityData();
    lastSend = millis();
    }

    client.loop();
    }

    void getAndSendTemperatureAndHumidityData()
    {
    Serial.println("Collecting temperature data.");

    // Reading temperature or humidity takes about 250 milliseconds!
    float h = dht.readHumidity();
    // Read temperature as Celsius (the default)
    float t = dht.readTemperature();

    // Check if any reads failed and exit early (to try again).
    if (isnan(h) || isnan(t)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
    }

    Serial.print("Humidity: ");
    Serial.print(h);
    Serial.print(" %t");
    Serial.print("Temperature: ");
    Serial.print(t);
    Serial.print(" *C ");

    String temperature = String(t);
    String humidity = String(h);


    // Just debug messages
    Serial.print( "Sending temperature and humidity : [" );
    Serial.print( temperature ); Serial.print( "," );
    Serial.print( humidity );
    Serial.print( "] -> " );

    // Prepare a JSON payload string
    String payload = "{";
    payload += ""temperature":"; payload += temperature; payload += ",";
    payload += ""humidity":"; payload += humidity;
    payload += "}";

    // Send payload
    char attributes[100];
    payload.toCharArray( attributes, 100 );
    client.publish( "esp8266/dht22", attributes );
    Serial.println( attributes );
    }

    void InitWiFi()
    {
    // initialize serial for ESP module
    Serial1.begin(115200);
    // initialize ESP module
    WiFi.init(&Serial1);

    // check for the presence of the shield
    if (WiFi.status() == WL_NO_SHIELD) {
    Serial.println("WiFi shield not present");
    // don't continue
    while (false);
    }

    // attempt to connect to WiFi network
    while ( status != WL_CONNECTED) {
    Serial.print("Attempting to connect to WPA SSID: ");
    // print the SSID of the network you're attached to
    //Serial.print("SSID: ");
    Serial.println(WiFi.SSID());
    // Connect to WPA/WPA2 network
    status = WiFi.begin(WIFI_AP, WIFI_PASSWORD);
    }
    }

    void reconnect() {
    // Loop until we're reconnected
    while (!client.connected()) {
    Serial.print("Connecting to CLOUD MQTT ...");
    // Attempt to connect (clientId, username, password)
    if ( client.connect("Arduino Uno Device", TOKEN, PASS) ) {
    Serial.println( "[DONE]" );
    } else {
    Serial.print( "[FAILED] [ rc = " );
    Serial.print( client.state() );
    Serial.println( " : retrying in 5 seconds]" );
    // Wait 5 seconds before retrying
    delay( 5000 );
    }
    }
    }


    The error I m getting are:serial monitor on arduino ide



    The cloud mqtt log says



    2019-01-04 10:51:28: Socket error on client Arduino Uno Device, disconnecting.
    2019-01-04 10:51:48: New connection from 103.215.241.176 on port 17094.
    2019-01-04 10:51:48: New client connected from 103.215.241.176 as Arduino Uno Device (c1, k15, u'ihiiwona').
    2019-01-04 10:51:48: No will message specified.
    2019-01-04 10:51:48: Sending CONNACK to Arduino Uno Device (0, 0)
    2019-01-04 10:52:11: Client Arduino Uno Device has exceeded timeout, disconnecting.
    2019-01-04 10:52:11: Socket error on client Arduino Uno Device, disconnecting.
    2019-01-04 10:52:14: New connection from 103.215.241.176 on port 17094.
    2019-01-04 10:52:14: New client connected from 103.215.241.176 as Arduino Uno Device (c1, k15, u'ihiiwona').
    2019-01-04 10:52:14: No will message specified.
    2019-01-04 10:52:14: Sending CONNACK to Arduino Uno Device (0, 0)
    2019-01-04 10:52:26: Received PINGREQ from MQTT_FX_Client
    2019-01-04 10:52:26: Sending PINGRESP to MQTT_FX_Client
    2019-01-04 10:52:36: Client Arduino Uno Device has exceeded timeout, disconnecting.
    2019-01-04 10:52:36: Socket error on client Arduino Uno Device, disconnecting.
    2019-01-04 10:52:40: New connection from 103.215.241.176 on port 17094.
    2019-01-04 10:53:26: Received PINGREQ from MQTT_FX_Client
    2019-01-04 10:53:26: Sending PINGRESP to MQTT_FX_Client
    2019-01-04 10:54:11: Client <unknown> has exceeded timeout, disconnecting.
    2019-01-04 10:54:11: Socket error on client <unknown>, disconnecting.


    Please someone help and tell me what i m doing wrong.










    share|improve this question

























      0












      0








      0








      I m trying to send the dht22 temperature and humidity data to cloud mqtt.
      I m using ESP8266 as wifi module to send the data from the arduino uno to the server.
      The libraries i m using are : wifiesp, Pubsubclient and dht
      The problem i m facing is that the connection to the mqtt server gets failed and returns -2 on serial monitor, sometimes i face data packet send error(2) and socket error.
      this is my first question on stackoverflow, so sorry for any error i made.



      My code is:



      #include "DHT.h"
      #include <WiFiEspClient.h>
      #include <WiFiEsp.h>
      #include <WiFiEspUdp.h>
      #include <PubSubClient.h>
      #include "SoftwareSerial.h"

      #define WIFI_AP "ssid"
      #define WIFI_PASSWORD "password"

      #define TOKEN "mqttusername"
      #define PASS "mqttpassword"

      // DHT
      #define DHTPIN 5
      #define DHTTYPE DHT22

      char mqttServer = "m15.cloudmqtt.com";

      // Initialize the Ethernet client object
      WiFiEspClient espClient;

      // Initialize DHT sensor.
      DHT dht(DHTPIN, DHTTYPE);

      PubSubClient client(espClient);

      SoftwareSerial Serial1(10,11); // RX, TX

      int status = WL_IDLE_STATUS;
      unsigned long lastSend;

      void setup() {
      // initialize serial for debugging
      Serial.begin(115200);

      dht.begin();
      InitWiFi();
      client.setServer( mqttServer, 17094 );
      lastSend = 0;
      }

      void loop() {
      //status = WiFi.status();

      if ( !client.connected() ) {
      reconnect();
      }

      if ( millis() - lastSend > 1000 ) { // Update and send only after 1 seconds
      getAndSendTemperatureAndHumidityData();
      lastSend = millis();
      }

      client.loop();
      }

      void getAndSendTemperatureAndHumidityData()
      {
      Serial.println("Collecting temperature data.");

      // Reading temperature or humidity takes about 250 milliseconds!
      float h = dht.readHumidity();
      // Read temperature as Celsius (the default)
      float t = dht.readTemperature();

      // Check if any reads failed and exit early (to try again).
      if (isnan(h) || isnan(t)) {
      Serial.println("Failed to read from DHT sensor!");
      return;
      }

      Serial.print("Humidity: ");
      Serial.print(h);
      Serial.print(" %t");
      Serial.print("Temperature: ");
      Serial.print(t);
      Serial.print(" *C ");

      String temperature = String(t);
      String humidity = String(h);


      // Just debug messages
      Serial.print( "Sending temperature and humidity : [" );
      Serial.print( temperature ); Serial.print( "," );
      Serial.print( humidity );
      Serial.print( "] -> " );

      // Prepare a JSON payload string
      String payload = "{";
      payload += ""temperature":"; payload += temperature; payload += ",";
      payload += ""humidity":"; payload += humidity;
      payload += "}";

      // Send payload
      char attributes[100];
      payload.toCharArray( attributes, 100 );
      client.publish( "esp8266/dht22", attributes );
      Serial.println( attributes );
      }

      void InitWiFi()
      {
      // initialize serial for ESP module
      Serial1.begin(115200);
      // initialize ESP module
      WiFi.init(&Serial1);

      // check for the presence of the shield
      if (WiFi.status() == WL_NO_SHIELD) {
      Serial.println("WiFi shield not present");
      // don't continue
      while (false);
      }

      // attempt to connect to WiFi network
      while ( status != WL_CONNECTED) {
      Serial.print("Attempting to connect to WPA SSID: ");
      // print the SSID of the network you're attached to
      //Serial.print("SSID: ");
      Serial.println(WiFi.SSID());
      // Connect to WPA/WPA2 network
      status = WiFi.begin(WIFI_AP, WIFI_PASSWORD);
      }
      }

      void reconnect() {
      // Loop until we're reconnected
      while (!client.connected()) {
      Serial.print("Connecting to CLOUD MQTT ...");
      // Attempt to connect (clientId, username, password)
      if ( client.connect("Arduino Uno Device", TOKEN, PASS) ) {
      Serial.println( "[DONE]" );
      } else {
      Serial.print( "[FAILED] [ rc = " );
      Serial.print( client.state() );
      Serial.println( " : retrying in 5 seconds]" );
      // Wait 5 seconds before retrying
      delay( 5000 );
      }
      }
      }


      The error I m getting are:serial monitor on arduino ide



      The cloud mqtt log says



      2019-01-04 10:51:28: Socket error on client Arduino Uno Device, disconnecting.
      2019-01-04 10:51:48: New connection from 103.215.241.176 on port 17094.
      2019-01-04 10:51:48: New client connected from 103.215.241.176 as Arduino Uno Device (c1, k15, u'ihiiwona').
      2019-01-04 10:51:48: No will message specified.
      2019-01-04 10:51:48: Sending CONNACK to Arduino Uno Device (0, 0)
      2019-01-04 10:52:11: Client Arduino Uno Device has exceeded timeout, disconnecting.
      2019-01-04 10:52:11: Socket error on client Arduino Uno Device, disconnecting.
      2019-01-04 10:52:14: New connection from 103.215.241.176 on port 17094.
      2019-01-04 10:52:14: New client connected from 103.215.241.176 as Arduino Uno Device (c1, k15, u'ihiiwona').
      2019-01-04 10:52:14: No will message specified.
      2019-01-04 10:52:14: Sending CONNACK to Arduino Uno Device (0, 0)
      2019-01-04 10:52:26: Received PINGREQ from MQTT_FX_Client
      2019-01-04 10:52:26: Sending PINGRESP to MQTT_FX_Client
      2019-01-04 10:52:36: Client Arduino Uno Device has exceeded timeout, disconnecting.
      2019-01-04 10:52:36: Socket error on client Arduino Uno Device, disconnecting.
      2019-01-04 10:52:40: New connection from 103.215.241.176 on port 17094.
      2019-01-04 10:53:26: Received PINGREQ from MQTT_FX_Client
      2019-01-04 10:53:26: Sending PINGRESP to MQTT_FX_Client
      2019-01-04 10:54:11: Client <unknown> has exceeded timeout, disconnecting.
      2019-01-04 10:54:11: Socket error on client <unknown>, disconnecting.


      Please someone help and tell me what i m doing wrong.










      share|improve this question














      I m trying to send the dht22 temperature and humidity data to cloud mqtt.
      I m using ESP8266 as wifi module to send the data from the arduino uno to the server.
      The libraries i m using are : wifiesp, Pubsubclient and dht
      The problem i m facing is that the connection to the mqtt server gets failed and returns -2 on serial monitor, sometimes i face data packet send error(2) and socket error.
      this is my first question on stackoverflow, so sorry for any error i made.



      My code is:



      #include "DHT.h"
      #include <WiFiEspClient.h>
      #include <WiFiEsp.h>
      #include <WiFiEspUdp.h>
      #include <PubSubClient.h>
      #include "SoftwareSerial.h"

      #define WIFI_AP "ssid"
      #define WIFI_PASSWORD "password"

      #define TOKEN "mqttusername"
      #define PASS "mqttpassword"

      // DHT
      #define DHTPIN 5
      #define DHTTYPE DHT22

      char mqttServer = "m15.cloudmqtt.com";

      // Initialize the Ethernet client object
      WiFiEspClient espClient;

      // Initialize DHT sensor.
      DHT dht(DHTPIN, DHTTYPE);

      PubSubClient client(espClient);

      SoftwareSerial Serial1(10,11); // RX, TX

      int status = WL_IDLE_STATUS;
      unsigned long lastSend;

      void setup() {
      // initialize serial for debugging
      Serial.begin(115200);

      dht.begin();
      InitWiFi();
      client.setServer( mqttServer, 17094 );
      lastSend = 0;
      }

      void loop() {
      //status = WiFi.status();

      if ( !client.connected() ) {
      reconnect();
      }

      if ( millis() - lastSend > 1000 ) { // Update and send only after 1 seconds
      getAndSendTemperatureAndHumidityData();
      lastSend = millis();
      }

      client.loop();
      }

      void getAndSendTemperatureAndHumidityData()
      {
      Serial.println("Collecting temperature data.");

      // Reading temperature or humidity takes about 250 milliseconds!
      float h = dht.readHumidity();
      // Read temperature as Celsius (the default)
      float t = dht.readTemperature();

      // Check if any reads failed and exit early (to try again).
      if (isnan(h) || isnan(t)) {
      Serial.println("Failed to read from DHT sensor!");
      return;
      }

      Serial.print("Humidity: ");
      Serial.print(h);
      Serial.print(" %t");
      Serial.print("Temperature: ");
      Serial.print(t);
      Serial.print(" *C ");

      String temperature = String(t);
      String humidity = String(h);


      // Just debug messages
      Serial.print( "Sending temperature and humidity : [" );
      Serial.print( temperature ); Serial.print( "," );
      Serial.print( humidity );
      Serial.print( "] -> " );

      // Prepare a JSON payload string
      String payload = "{";
      payload += ""temperature":"; payload += temperature; payload += ",";
      payload += ""humidity":"; payload += humidity;
      payload += "}";

      // Send payload
      char attributes[100];
      payload.toCharArray( attributes, 100 );
      client.publish( "esp8266/dht22", attributes );
      Serial.println( attributes );
      }

      void InitWiFi()
      {
      // initialize serial for ESP module
      Serial1.begin(115200);
      // initialize ESP module
      WiFi.init(&Serial1);

      // check for the presence of the shield
      if (WiFi.status() == WL_NO_SHIELD) {
      Serial.println("WiFi shield not present");
      // don't continue
      while (false);
      }

      // attempt to connect to WiFi network
      while ( status != WL_CONNECTED) {
      Serial.print("Attempting to connect to WPA SSID: ");
      // print the SSID of the network you're attached to
      //Serial.print("SSID: ");
      Serial.println(WiFi.SSID());
      // Connect to WPA/WPA2 network
      status = WiFi.begin(WIFI_AP, WIFI_PASSWORD);
      }
      }

      void reconnect() {
      // Loop until we're reconnected
      while (!client.connected()) {
      Serial.print("Connecting to CLOUD MQTT ...");
      // Attempt to connect (clientId, username, password)
      if ( client.connect("Arduino Uno Device", TOKEN, PASS) ) {
      Serial.println( "[DONE]" );
      } else {
      Serial.print( "[FAILED] [ rc = " );
      Serial.print( client.state() );
      Serial.println( " : retrying in 5 seconds]" );
      // Wait 5 seconds before retrying
      delay( 5000 );
      }
      }
      }


      The error I m getting are:serial monitor on arduino ide



      The cloud mqtt log says



      2019-01-04 10:51:28: Socket error on client Arduino Uno Device, disconnecting.
      2019-01-04 10:51:48: New connection from 103.215.241.176 on port 17094.
      2019-01-04 10:51:48: New client connected from 103.215.241.176 as Arduino Uno Device (c1, k15, u'ihiiwona').
      2019-01-04 10:51:48: No will message specified.
      2019-01-04 10:51:48: Sending CONNACK to Arduino Uno Device (0, 0)
      2019-01-04 10:52:11: Client Arduino Uno Device has exceeded timeout, disconnecting.
      2019-01-04 10:52:11: Socket error on client Arduino Uno Device, disconnecting.
      2019-01-04 10:52:14: New connection from 103.215.241.176 on port 17094.
      2019-01-04 10:52:14: New client connected from 103.215.241.176 as Arduino Uno Device (c1, k15, u'ihiiwona').
      2019-01-04 10:52:14: No will message specified.
      2019-01-04 10:52:14: Sending CONNACK to Arduino Uno Device (0, 0)
      2019-01-04 10:52:26: Received PINGREQ from MQTT_FX_Client
      2019-01-04 10:52:26: Sending PINGRESP to MQTT_FX_Client
      2019-01-04 10:52:36: Client Arduino Uno Device has exceeded timeout, disconnecting.
      2019-01-04 10:52:36: Socket error on client Arduino Uno Device, disconnecting.
      2019-01-04 10:52:40: New connection from 103.215.241.176 on port 17094.
      2019-01-04 10:53:26: Received PINGREQ from MQTT_FX_Client
      2019-01-04 10:53:26: Sending PINGRESP to MQTT_FX_Client
      2019-01-04 10:54:11: Client <unknown> has exceeded timeout, disconnecting.
      2019-01-04 10:54:11: Socket error on client <unknown>, disconnecting.


      Please someone help and tell me what i m doing wrong.







      c++ arduino mqtt esp8266 arduino-esp8266






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 4 at 12:00









      Binay DekaBinay Deka

      12




      12
























          0






          active

          oldest

          votes












          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54038592%2fmqtt-connection-failing-serial-monitor-returns-2-in-arduino-ide%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54038592%2fmqtt-connection-failing-serial-monitor-returns-2-in-arduino-ide%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Mossoró

          Error while reading .h5 file using the rhdf5 package in R

          Pushsharp Apns notification error: 'InvalidToken'