Esp8266at wont compile


#1

Hi every one.
I have tried for some time now to get the esp8266at to work but it wont compile.
I get a lot of errors. I have tried to figure this out by editing the ThingerESP8266AT.h file and some of the files in the tinyGSM library but i only made it worse.

This is the original errors i got with the library’s freshly installed:

In file included from C:\Users\mrg\Documents\Arduino\libraries\arduino_796449\examples\ESP8266\ESP8266AT\ESP8266AT.ino:6:0:

C:\Users\mrg\Documents\Arduino\libraries\arduino_796449\src/ThingerESP8266AT.h:67:5: error: ‘TinyGsm’ does not name a type

 TinyGsm serial_;

 ^

C:\Users\mrg\Documents\Arduino\libraries\arduino_796449\src/ThingerESP8266AT.h:68:5: error: ‘TinyGsm’ does not name a type

 TinyGsm::GsmClient client_;

 ^

C:\Users\mrg\Documents\Arduino\libraries\arduino_796449\src/ThingerESP8266AT.h: In constructor ‘ThingerESP8266AT::ThingerESP8266AT(const char*, const char*, const char*, Stream&)’:

C:\Users\mrg\Documents\Arduino\libraries\arduino_796449\src/ThingerESP8266AT.h:33:13: error: class ‘ThingerESP8266AT’ does not have any field named ‘serial_’

         serial_(serial),

         ^

In file included from C:\Users\mrg\Documents\Arduino\libraries\arduino_796449\src/ThingerESP8266AT.h:27:0,

             from C:\Users\mrg\Documents\Arduino\libraries\arduino_796449\examples\ESP8266\ESP8266AT\ESP8266AT.ino:6:

C:\Users\mrg\Documents\Arduino\libraries\arduino_796449\src/ThingerClient.h:413:13: error: ‘Client& ThingerClient::client_’ is private

 Client& client_;

         ^

In file included from C:\Users\mrg\Documents\Arduino\libraries\arduino_796449\examples\ESP8266\ESP8266AT\ESP8266AT.ino:6:0:

C:\Users\mrg\Documents\Arduino\libraries\arduino_796449\src/ThingerESP8266AT.h:34:13: error: within this context

         client_(serial_),

         ^

C:\Users\mrg\Documents\Arduino\libraries\arduino_796449\src/ThingerESP8266AT.h:34:13: error: class ‘ThingerESP8266AT’ does not have any field named ‘client_’

C:\Users\mrg\Documents\Arduino\libraries\arduino_796449\src/ThingerESP8266AT.h:34:21: error: ‘serial_’ was not declared in this scope

         client_(serial_),

                 ^

In file included from C:\Users\mrg\Documents\Arduino\libraries\arduino_796449\src/ThingerESP8266AT.h:27:0,

             from C:\Users\mrg\Documents\Arduino\libraries\arduino_796449\examples\ESP8266\ESP8266AT\ESP8266AT.ino:6:

C:\Users\mrg\Documents\Arduino\libraries\arduino_796449\src/ThingerClient.h:413:13: error: ‘Client& ThingerClient::client_’ is private

 Client& client_;

         ^

In file included from C:\Users\mrg\Documents\Arduino\libraries\arduino_796449\examples\ESP8266\ESP8266AT\ESP8266AT.ino:6:0:

C:\Users\mrg\Documents\Arduino\libraries\arduino_796449\src/ThingerESP8266AT.h:37:27: error: within this context

         ThingerClient(client_, user, device, device_credential)

                       ^

C:\Users\mrg\Documents\Arduino\libraries\arduino_796449\src/ThingerESP8266AT.h: In member function ‘virtual bool ThingerESP8266AT::network_connected()’:

C:\Users\mrg\Documents\Arduino\libraries\arduino_796449\src/ThingerESP8266AT.h:47:16: error: ‘serial_’ was not declared in this scope

     return serial_.isNetworkConnected();

            ^

C:\Users\mrg\Documents\Arduino\libraries\arduino_796449\src/ThingerESP8266AT.h: In member function ‘virtual bool ThingerESP8266AT::connect_network()’:

C:\Users\mrg\Documents\Arduino\libraries\arduino_796449\src/ThingerESP8266AT.h:51:16: error: ‘serial_’ was not declared in this scope

     return serial_.networkConnect(wifi_ssid_, wifi_password_);

            ^

Please help me

I have been using Arduino Uno with sim808 connected to thinger for some time now and i’m super happy about how it works. But I wont to connect some thing at home as well so i hope someone want to help me with this esp8266 issue.

Thanks


#2

Hi,

use this example code:

// Uncomment this for debug
// #define _DEBUG_

// Can be installed from Library Manager or https://github.com/vshymanskyy/TinyGSM
#define TINY_GSM_MODEM_ESP8266
#include <TinyGsmClient.h>
#include <ThingerESP8266AT.h>

#define USERNAME "you_username"
#define DEVICE_ID "your_device_id"
#define DEVICE_CREDENTIAL "your_device_credential"

#define SSID "your_wifi_ssid"
#define SSID_PASSWORD "your_wifi_password"

// Emulate Serial1 on pins 10/11 if HW is not present (use interrupt pins for better performance)
#ifndef HAVE_HWSERIAL1
#include "SoftwareSerial.h"
SoftwareSerial Serial1(10,11); // RX, TX
#endif

ThingerESP8266AT thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL, Serial1);

void setup() {
  // uncomment this for debug over serial
  // Serial.begin(115200);

  /* Notice: initialize serial for ESP8266 at your ESP8266 baud rate
   * You can change the baud rate of ESP8266 sending a command like "AT+UART_DEF=9600,8,1,0,0\r\n"
   * Test with different rates, and use the higher one that works with your setup.
   */
  Serial1.begin(9600);

  thing.add_wifi(SSID, SSID_PASSWORD);

  // digital pin control example (i.e. turning on/off a light, a relay, configuring a parameter, etc)
  pinMode(LED_BUILTIN, OUTPUT);
  thing["led"] << digitalPin(LED_BUILTIN);

  // resource output example (i.e. reading a sensor value)
  thing["millis"] >> outputValue(millis());

  // more details at http://docs.thinger.io/arduino/
}

void loop() {
  thing.handle();
}

We will update the example. Thanks for reporting! :wink:


#3

haha. Its always the small things that makes a big difference :smiley:
#define TINY_GSM_MODEM_ESP8266
#include <TinyGsmClient.h>

Thanks a lot for helping me out. That was very kind of you
Kind regards


#4

Hi.

Any idea what this is about?
I have tried to connect it whit my phone as a wifi router, but it did not make any difference.
I have also compared the some libraries that i know will connect(gsm and ethernet), trying to find out what is happening in regards to the address to thinger io and the ports.
I have also tried with secure connection on port 25202 with no success

any idea whats going on here?

[NETWORK] Starting connection…
[NETWORK] Connected!
[_SOCKET] Connecting to iot.thinger.io:25200
[_SOCKET] Using secure TLS/SSL connection: no
[_SOCKET] Error while connecting!

Best regards