Error ThingerWiFi.h

Hi there,

I’m trying to test one of your examples “ESP8266” with DHT22 and this is my code:

#include <SPI.h>
#include <ESP8266wifi.h>
#include <ThingerWifi.h>
#include "DHT.h"

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

#define SSID "Wi-Fi Waves"
#define SSID_PASSWORD "f3rr3ir4"

#define DHTPIN 22 //pin no arduino
#define DHTTYPE DHT22 

ThingerWifi thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL);

DHT dht(DHTPIN, DHTTYPE);

void setup() {


  thing.add_wifi(SSID, SSID_PASSWORD);


   thing["Temperatura"] >> [](pson& out){out = dht.readTemperature();};
   thing["Humidade"] >> [](pson& out){out = dht.readHumidity();};

}

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

but gives me this error:

Arduino: 1.6.7 (Windows 10), Placa:"Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

In file included from C:\Users\João\Documents\Arduino\libraries\thinger.io\src/ThingerWifi.h:27:0,

                 from C:\Users\João\Documents\Arduino\Estufa\Estufa.ino:3:

C:\Users\João\Documents\Arduino\libraries\thinger.io\src/ThingerClient.h:42:25: error: expected ')' before '&' token

     ThingerClient(Client& client, const char* user, const char* device, const char* device_credential) :

                         ^

C:\Users\João\Documents\Arduino\libraries\thinger.io\src/ThingerClient.h:242:5: error: 'Client' does not name a type

     Client& client_;

     ^

C:\Users\João\Documents\Arduino\libraries\thinger.io\src/ThingerClient.h: In member function 'virtual bool ThingerClient::read(char*, size_t)':

C:\Users\João\Documents\Arduino\libraries\thinger.io\src/ThingerClient.h:60:24: error: 'client_' was not declared in this scope

             int read = client_.readBytes((char*)buffer, size-total_read);

                        ^

C:\Users\João\Documents\Arduino\libraries\thinger.io\src/ThingerClient.h: In member function 'virtual bool ThingerClient::write(const char*, size_t, bool)':

C:\Users\João\Documents\Arduino\libraries\thinger.io\src/ThingerClient.h:80:30: error: 'client_' was not declared in this scope

             size_t written = client_.write(temp_data_, out_size_);

                              ^

C:\Users\João\Documents\Arduino\libraries\thinger.io\src/ThingerClient.h: In member function 'virtual void ThingerClient::disconnected()':

C:\Users\João\Documents\Arduino\libraries\thinger.io\src/ThingerClient.h:104:9: error: 'client_' was not declared in this scope

         client_.stop();

         ^

C:\Users\João\Documents\Arduino\libraries\thinger.io\src/ThingerClient.h: In member function 'bool ThingerClient::handle_connection()':

C:\Users\João\Documents\Arduino\libraries\thinger.io\src/ThingerClient.h:191:23: error: 'client_' was not declared in this scope

         bool client = client_.connected();

                       ^

C:\Users\João\Documents\Arduino\libraries\thinger.io\src/ThingerClient.h: In member function 'bool ThingerClient::connect_client()':

C:\Users\João\Documents\Arduino\libraries\thinger.io\src/ThingerClient.h:203:9: error: 'client_' was not declared in this scope

         client_.stop(); // cleanup previous socket

         ^

C:\Users\João\Documents\Arduino\libraries\thinger.io\src/ThingerClient.h: In member function 'void ThingerClient::handle()':

C:\Users\João\Documents\Arduino\libraries\thinger.io\src/ThingerClient.h:234:48: error: 'client_' was not declared in this scope

             thinger::thinger::handle(millis(), client_.available()>0);

                                                ^

In file included from C:\Users\João\Documents\Arduino\Estufa\Estufa.ino:3:0:

C:\Users\João\Documents\Arduino\libraries\thinger.io\src/ThingerWifi.h: At global scope:

C:\Users\João\Documents\Arduino\libraries\thinger.io\src/ThingerWifi.h:89:5: error: 'WiFiClient' does not name a type

     WiFiClient client_;

     ^

C:\Users\João\Documents\Arduino\libraries\thinger.io\src/ThingerWifi.h: In constructor 'ThingerWifi::ThingerWifi(const char*, const char*, const char*)':

C:\Users\João\Documents\Arduino\libraries\thinger.io\src/ThingerWifi.h:33:27: error: 'client_' was not declared in this scope

             ThingerClient(client_, user, device, device_credential)

                           ^

C:\Users\João\Documents\Arduino\libraries\thinger.io\src/ThingerWifi.h: In member function 'virtual bool ThingerWifi::network_connected()':

C:\Users\João\Documents\Arduino\libraries\thinger.io\src/ThingerWifi.h:43:16: error: 'WiFi' was not declared in this scope

         return WiFi.status() == WL_CONNECTED && !(WiFi.localIP() == INADDR_NONE);

                ^

C:\Users\João\Documents\Arduino\libraries\thinger.io\src/ThingerWifi.h:43:33: error: 'WL_CONNECTED' was not declared in this scope

         return WiFi.status() == WL_CONNECTED && !(WiFi.localIP() == INADDR_NONE);

                                 ^

C:\Users\João\Documents\Arduino\libraries\thinger.io\src/ThingerWifi.h:43:69: error: 'INADDR_NONE' was not declared in this scope

         return WiFi.status() == WL_CONNECTED && !(WiFi.localIP() == INADDR_NONE);

                                                                     ^

C:\Users\João\Documents\Arduino\libraries\thinger.io\src/ThingerWifi.h: In member function 'virtual bool ThingerWifi::connect_network()':

C:\Users\João\Documents\Arduino\libraries\thinger.io\src/ThingerWifi.h:52:9: error: 'WiFi' was not declared in this scope

         WiFi.begin(wifi_ssid_, wifi_password_);

         ^

C:\Users\João\Documents\Arduino\libraries\thinger.io\src/ThingerWifi.h:53:33: error: 'WL_CONNECTED' was not declared in this scope

         while( WiFi.status() != WL_CONNECTED) {

                                 ^

C:\Users\João\Documents\Arduino\libraries\thinger.io\src/ThingerWifi.h:66:34: error: 'INADDR_NONE' was not declared in this scope

         while (WiFi.localIP() == INADDR_NONE) {

                                  ^

C:\Users\João\Documents\Arduino\Estufa\Estufa.ino: In function 'void setup()':

C:\Users\João\Documents\Arduino\Estufa\Estufa.ino:23:37: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

C:\Users\João\Documents\Arduino\Estufa\Estufa.ino:23:37: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

exit status 1
Erro ao compilar.

  Este relatório teria mais informação com
  "Mostrar mensagens detalhadas durante a compilação"
  ativo em Ficheiro > Preferências

Can anyone help me pls.

Some thoughts:

  • You are trying to compile a code for the ESP8266, but you have selected the Arduino Mega as board (regarding the compiler output). If you have an ESP8266, you must select it in the compiler to have their libraries available.
  • Be careful with the includes, not sure if your OS is case sensitive, but fix the include #include <ESP8266wifi.h> to #include <ESP8266WiFi.h>

Can you give me more details about your setup? board, etc?

Hi there,

i just changed to ESP8266 Generic and the error now is

esp8266: Unknown package.

Error compiling

I also changed the include (it’s case sensitive).

I send you an image with the setup ( board is a Mega 2560).

I think that the Arduino 1.6.7 is not compatible with the ESP8266 library. Try to switch your Arduino version to version 1.6.5, or as recently stated in the Github page, now it is supported in Arduino 1.6.8. Hope this help!