elementzonline / SIM800_MQTT

Visit our blog/website for more information
http://www.elementzonline.com
GNU General Public License v3.0
170 stars 96 forks source link

[QUESTION] ESP8266 compatibility #25

Closed Franciscopcosta closed 4 years ago

Franciscopcosta commented 6 years ago

How can i adapt it to work with ESP8266?

kristofferJr commented 6 years ago

I'm asking the same question

elementzonline commented 6 years ago

Yes, there are some changes to be done in AT commands, otherwise should be working fine. But writing code directly to support MQTT in ESP8266 is the straightforward approach.

agozie commented 5 years ago

For all those getting stuck at MQTT.MessageFlag = true when using software serial, ESP8266 or other platforms, change GSM_MQTT::processing in GSM_MQTT.cpp to


void GSM_MQTT::processing(void)
{
 if (TCP_Flag == false)
  {
    MQTT_Flag = false;
    _tcpInit();
  }
  _ping();

  //**************new code*****************
  unsigned long t = millis();
  //add long waitPeriod = 0; somewhere at the beginning of the file
  if (t - waitPeriod > 1000L) 
  {
    waitPeriod = t;
    serialEvent(); //call serialEvent every second
  }
  //*****************************************

}
elementzonline commented 4 years ago

Closing the issue as ESP8266 is offtopic and not intended as the target for this library