Error: ESP8266_Lib.h:

Hi, I’m trying a long time ago how to connect my arduino mega 2560 with esp8266 and every time I try something new it always throws me the same error
I leave details of the error and the code that I am using.

#include <ESP8266_Lib.h>
#include <cayenneMQTTESP8266.h>
#define CAYENNE_DEBUG
#define CAYENNE_PRINT Serial

//Coneccion a internet 
char ssid[] = "";
char wifiPassword[] = "";

//Autentificacion chayanne
char username[] = ""
char password[] = ""
char clientID[] = ""

unsigned long lastmillis = 0;
 
void setup() {
  Serial.begin(9600);
  Cayenne.begin(username, password, cleintID, ssid, wifiPassword)
  
}

void loop() { 
  cayenne.loop();
  
  //publica datos cada 10 segundos
  if (millis() - lastMillis > 1000) {
    lastmillis = millis();
    //escribe datos en chayanne     
    cayenne.virtualWrite( 0, lastmillis);

  }
}
  
CAYENNE_IN_DEFAULT()
 

{ 

C:\Users\Snaab\Desktop\tesis\IDE\chayane\chayane.ino:2:25: fatal error: ESP8266_Lib.h: No such file or directory

#include <ESP8266_Lib.h>
^

compilation terminated.

exit status 1
Error compilando para la tarjeta Arduino/Genuino Mega or Mega 2560.

you are doing it wrong. follow this steps Cayenne-MQTT-Arduino/ESP8266Shield.ino at master · myDevicesIoT/Cayenne-MQTT-Arduino · GitHub

Use the program that you told me with the corresponding libraries, the problem of the library that attached me the things that I have to do with the problem. I also attached the error that came back out if you helped me please.

Opciones de compilación cambiadas, reconstruyendo todo
In file included from D:\tesis\IDE\prueba_33333333\prueba_33333333.ino:18:0:

C:\Users\Snaab\Documents\Arduino\libraries\CayenneMQTT\src/CayenneMQTTESP8266Shield.h:31:34: fatal error: ESP8266SerialLibrary.h: No such file or directory

#include “ESP8266SerialLibrary.h”

                              ^

compilation terminated.

exit status 1
Error compilando para la tarjeta Arduino/Genuino Mega or Mega 2560.

please follow the steps from the link i gave. step 1 is installing the library.

Search and download the Internet library and the problem persists. Could you send me the link to the bookstore that you tell me is missing please.

Steps:

  1. Install the ESP8266SerialLibrary.zip library via the Arduino IDE (Sketch->Include Library->Add .ZIP Library) from the Cayenne extras/libraries folder (e.g. My Documents\Arduino\libraries\CayenneMQTT\extras\libraries) to compile this example.
  2. Connect the ESP8266 as a shield to your Arduino. This example uses the Serial1 hardware serial pins available on the Mega. You can also try
    using a software serial, though it may be less stable.
  3. Set the Cayenne authentication info to match the authentication info from the Dashboard.
  4. Set the network name and password.
  5. Compile and upload the sketch.
  6. A temporary widget will be automatically generated in the Cayenne Dashboard. To make the widget permanent click the plus sign on the widget.

I already fix the problem of the bookstores but I get the image. Could you tell me how the pins of the esp8266 are connected to the ArduinoMega2560?
I have connected
vcc and ch_pd - 3.3v
gnd - gnd
rx - rx0 (arduino pin)
tx - tx1
It’s okay?

Captura

See if I’m connected to the internet and even then nothing happens.

Hi again, I’m trying to send analog data from 3 gas sensors (MQ2) but only get one. Previously I tried sending only one and if it worked, but when you add the other two and save the program, you only receive the data from one channel. I enclose the program I use and the photo of the widgets.

//#define CAYENNE_DEBUG // Uncomment to show debug messages
#define CAYENNE_PRINT Serial // Comment this out to disable prints and save space
#include <CayenneMQTTESP8266Shield.h>

// WiFi network info.
char ssid = “Aceituna”;
char wifiPassword = “vaquito123”;

// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
char username = “50c54bf0-1b49-11e8-b42d-698bd45831f1”;
char password = “5c683ef173bb78d7829f2a96b938ff2c6614e345”;
char clientID = “415eee60-1f08-11e8-b42d-698bd45831f1”;

// Set ESP8266 Serial object. In this example we use the Serial1 hardware serial which is available on boards like the Arduino Mega.
#define EspSerial Serial1
#define PinAna 0
#define VIRTUAL_CHANNEL 2

#define PinAna1 1
#define VIRTUAL_CHANNEL 4

#define PinAna2 2
#define VIRTUAL_CHANNEL 6

ESP8266 wifi(&EspSerial);

void setup()
{
Serial.begin(9600);
delay(10);

// Set ESP8266 baud rate
EspSerial.begin(115200);
delay(10);

Cayenne.begin(username, password, clientID, wifi, ssid, wifiPassword);
}

void loop()
{
Cayenne.loop();
}

// This function is called at intervals to send sensor data to Cayenne.
CAYENNE_OUT(VIRTUAL_CHANNEL)
{
Cayenne.virtualWrite(VIRTUAL_CHANNEL, analogRead(PinAna));

Cayenne.virtualWrite(VIRTUAL_CHANNEL, analogRead(PinAna1));

Cayenne.virtualWrite(VIRTUAL_CHANNEL, analogRead(PinAna2));

}

Is the logic of the program fine?
and another problem I have is that the sensor does not fall below this value


Is there a way to lower it to 0 or> 100?

I already fixed the problem so that I could read the other sensors, now I would like to know if I can leave the rods in 0 or in a lower number

1 Like