ERROR compiling for board generic ESP8266 (Arduino mega))

I received this error when trying to upload code to the Arduino mega board. I have connected the mega board with esp8266 to send and receive data from firebase's real-time database. any idea how can I solve it?

error -

Arduino: 1.8.15 (Windows Store 1.8.49.0) (Windows 10), Board: "Generic ESP8266 Module, 80 MHz, Flash, Disabled (new aborts on oom), Disabled, All SSL ciphers (most compatible), 32KB cache + 32KB IRAM (balanced), Use pgm_read macros for IRAM/PROGMEM, dtr (aka nodemcu), 26 MHz, 40MHz, DOUT (compatible), 1MB (FS:64KB OTA:~470KB), 2, nonos-sdk 2.2.1+100 (190703), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

C:\Users\PC\Documents\Arduino\libraries\firebase-arduino-master\src\FirebaseHttpClient_Esp8266.cpp: In member function 'virtual void FirebaseHttpClientEsp8266::begin(const string&)':

C:\Users\PC\Documents\Arduino\libraries\firebase-arduino-master\src\FirebaseHttpClient_Esp8266.cpp:47:50: error: no matching function for call to 'begin(const char*, const char [60])'

47 | http_.begin(url.c_str(), kFirebaseFingerprint);

  |                                                  ^

In file included from C:\Users\PC\Documents\Arduino\libraries\firebase-arduino-master\src\FirebaseHttpClient_Esp8266.cpp:9:

C:\Users\PC\Documents\ArduinoData\packages\esp8266\hardware\esp8266\3.0.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:166:10: note: candidate: 'bool HTTPClient::begin(String, uint16_t, String)' (near match)

166 | bool begin(String host, uint16_t port, String uri = "/") attribute ((error("obsolete API, use ::begin(WiFiClient, host, port, uri)")));

  |          ^~~~~

C:\Users\PC\Documents\ArduinoData\packages\esp8266\hardware\esp8266\3.0.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:166:10: note: conversion of argument 2 would be ill-formed:

C:\Users\PC\Documents\Arduino\libraries\firebase-arduino-master\src\FirebaseHttpClient_Esp8266.cpp:47:30: error: invalid conversion from 'const char*' to 'uint16_t' {aka 'short unsigned int'} [-fpermissive]

47 | http_.begin(url.c_str(), kFirebaseFingerprint);

  |                              ^~~~~~~~~~~~~~~~~~~~

  |                              |

  |                              const char*

In file included from C:\Users\PC\Documents\Arduino\libraries\firebase-arduino-master\src\FirebaseHttpClient_Esp8266.cpp:9:

C:\Users\PC\Documents\ArduinoData\packages\esp8266\hardware\esp8266\3.0.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:167:10: note: candidate: 'bool HTTPClient::begin(String, const uint8_t*)' (near match)

167 | bool begin(String url, const uint8_t httpsFingerprint[20]) attribute ((error("obsolete API, use ::begin(WiFiClientSecure, ...)")));

  |          ^~~~~

C:\Users\PC\Documents\ArduinoData\packages\esp8266\hardware\esp8266\3.0.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:167:10: note: conversion of argument 2 would be ill-formed:

C:\Users\PC\Documents\Arduino\libraries\firebase-arduino-master\src\FirebaseHttpClient_Esp8266.cpp:47:30: error: invalid conversion from 'const char*' to 'const uint8_t*' {aka 'const unsigned char*'} [-fpermissive]

47 | http_.begin(url.c_str(), kFirebaseFingerprint);

  |                              ^~~~~~~~~~~~~~~~~~~~

  |                              |

  |                              const char*

C:\Users\PC\Documents\Arduino\libraries\firebase-arduino-master\src\FirebaseHttpClient_Esp8266.cpp: In member function 'virtual void FirebaseHttpClientEsp8266::begin(const string&, const string&)':

C:\Users\PC\Documents\Arduino\libraries\firebase-arduino-master\src\FirebaseHttpClient_Esp8266.cpp:51:60: error: invalid conversion from 'const char*' to 'const uint8_t*' {aka 'const unsigned char*'} [-fpermissive]

51 | http_.begin(host.c_str(), kFirebasePort, path.c_str(), kFirebaseFingerprint);

  |                                                            ^~~~~~~~~~~~~~~~~~~~

  |                                                            |

  |                                                            const char*

In file included from C:\Users\PC\Documents\Arduino\libraries\firebase-arduino-master\src\FirebaseHttpClient_Esp8266.cpp:9:

C:\Users\PC\Documents\ArduinoData\packages\esp8266\hardware\esp8266\3.0.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:168:70: note: initializing argument 4 of 'bool HTTPClient::begin(String, uint16_t, String, const uint8_t*)'

168 | bool begin(String host, uint16_t port, String uri, const uint8_t httpsFingerprint[20]) attribute ((error("obsolete API, use ::begin(WiFiClientSecure, ...)")));

  |                                                        ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~

exit status 1

Error compiling for board Generic ESP8266 Module.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

code -

#include <ESP8266WiFi.h>
#include <FirebaseArduino.h>

#define FIREBASE_HOST "..............."
#define FIREBASE_AUTH "........................."
#define WIFI_SSID ".................."
#define WIFI_PASSWORD "........................"

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

// connect to wifi.
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
Serial.print("connecting");
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(500);
}
Serial.println();
Serial.print("connected: ");
Serial.println(WiFi.localIP());

Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);
}

int n = 0;

void loop() {
// set value
Firebase.setFloat("number", 42.0);
// handle error
if (Firebase.failed()) {
Serial.print("setting /number failed:");
Serial.println(Firebase.error());
return;
}
delay(1000);

// update value
Firebase.setFloat("number", 43.0);
// handle error
if (Firebase.failed()) {
Serial.print("setting /number failed:");
Serial.println(Firebase.error());
return;
}
delay(1000);

// get value
Serial.print("number: ");
Serial.println(Firebase.getFloat("number"));
delay(1000);

// remove value
Firebase.remove("number");
delay(1000);

// set string value
Firebase.setString("message", "hello world");
// handle error
if (Firebase.failed()) {
Serial.print("setting /message failed:");
Serial.println(Firebase.error());
return;
}
delay(1000);

// set bool value
Firebase.setBool("truth", false);
// handle error
if (Firebase.failed()) {
Serial.print("setting /truth failed:");
Serial.println(Firebase.error());
return;
}
delay(1000);

// append a new value to /logs
String name = Firebase.pushInt("logs", n++);
// handle error
if (Firebase.failed()) {
Serial.print("pushing /logs failed:");
Serial.println(Firebase.error());
return;
}
Serial.print("pushed: /logs/");
Serial.println(name);
delay(1000);
}

Your post was MOVED to its current location as it is more suitable.

Could you also take a few moments to Learn How To Use The Forum.

Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum in the future.

1 Like

Why are you trying to upload code meant for an ESP8266 to a Mega? The two are not compatible.

1 Like

But from the error message

you had the ESP8266 board selected at the time

1 Like

so it only works on uno board only then. is there any wifi module that compatible with mega board

yes i did

ok sir i will and thank you

I'm using some tutorials to get idea about mega with ESP8266. I'm just a beginner. I need to send data to the firebase for my project with my mega board. I'm really grateful if you can tell me a way to deal with this matter. I need to use mega board because I have another program to run at the same time. firstly, I need to send and receive data from the real time data base of firebase. thank you

any ESP-thing can be made "compatible" with any other microcontroller.
I guess you have a misconception about how a microcontroller and a second microcontroller (in your case an ESP8266) work together.

Any ESP8266-board is a microcontroller on its own. Even this tiny ESP8266-01
The communication between any ESP8266 and another microcontroller is not standardised in a way like USB-devices: plug in and it will work together. USB-devices are hyper-ultra-standardised. That's way it all works together by just plugin in.

The microcontrollerworld is not superstandardised. You have to take care of more than just
"does the plug fit into the socket?

What is the exact type of ESP8266 you do have?

Is it an

  • ESP8266-01?,
  • ESP8266 Wemos D1 mini?
  • ESP8266 nodeMCU?
  • something else?

If you don't need the huge amount of IO-pins an Arduino Mega 2560 has
something like an ESP8266 nodeMCU or ESP32 nodeMCU can do all the sensor measuring, sending data to a display and hold a WiFi-connection all at the same time which makes the Arduino completely obsolete.

So if you give an overview about your whole project much better suggestions can be made.
best regards Stefan

1 Like

Ok, sir, I have bought a nodeMCU board. I need to get some sensor data from the firebase real-time database and need to update it in a variable in my mega code. sensor data was given by another computer. those data need to update automatically when running the program on the Arduino board. can you help me to start and continue this project. I'm really grateful if u can help me, sir.

Hi ravirulz,

it is not yet really clear to me what you want to do. I write in my own words what I have understood:

Device2 -->--Sensor-Data-->--Device1

There is somewhere a computer with a firebaseDatabase.
From the computer running the firebase-database sensor-data must be send to your Arduino Mega and be stored in a variable.

Device1: FirebaseDatabase-->--sensor-data-->--Arduino-Mega ---> variable.

Arduino-UnoBoard -->--Sensor-Data-->--Device1

I highly doubt that this is a correct description. But that is what YOU have written!

Before I support your project YOU must fullfill certain conditions:

Write a very detailed description of what you want to do:

  • Use highly specific names.

Your post above mentions a "mega" and an "Arduino Board" does this mean the same or two different devices? How should I know this?

  • write what kind of sensor-data this is?

You are working on an informatic project. And what is needed most in an informatic project is information.

If english is not your native language then write everything in your native language and let do google-translate the translation.
giving too less information leads to a lot of asking back and maybe to project-failing.

You have three chances to show substantial progress in posting much more detailed what you want to do.

best regards Stefan

1 Like

Yes sir, sorry for the inconvenience caused. I don't have my native language keyboard. so, I will try my best to tell you all the things.
sir, my project is a group project. my friend is getting inputs of a traffic color light system using a camera. these inputs were saved as a video and doing image processing to count the vehicle density in each lane in the junction. when he is counting, he is updating 8 variables that represent 8 lanes of vehicle density to a firebase real-time database. he is doing this using Node-red and using the Windows PC. I don't know many details of his project side because we didn't meet because of the covid situation. Also, he is using RFID sensors and upload those data to the Firebase database through the Arduino UNO board.
This will give a brief background idea and now we can enter my part.
For my part, I have to get those data from the firebase to my Arduino Mega board. Arduino Mega board doesn't have any WIFI and because of that, I use an ESP8266 NoduMCU board to connect the wifi. with this, I can access his firebase database and get those sensor and image processing data. I have to get that data and control the color lights from the inputs given by my friend. So I'm stuck in the part to update my variables in Arduino Mega board by using the firebase database values. I have done some tutorials with the Node MCU board but didn't do any serial communication between Arduino Mega and NodeMCU. Thank you for your time, sir.

You are saying that accessing the firebase-database is working and that you get the data
So please post the code that does

again quoting you "access his firebase database and get those sensor and image processing data"

post the code with this method:
There is an automatic function for doing this in the Arduino-IDE
just three steps

  1. press Ctrl-T for autoformatting your code
  2. do a rightclick with the mouse and choose "copy for forum"
  3. paste clipboard into write-window of a posting

best regards Stefan

opps sorry sir. it need to be need instead of can. i didn't have any code sir. but i will send the working code for the esp8266 nodemcu without mega board.

#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>

/*Put your SSID & Password*/
const char* ssid = "Slt fibre";  // Enter SSID here
const char* password = "10210521";  //Enter Password here

ESP8266WebServer server(80);

uint8_t LED1pin = D7;
bool LED1status = LOW;

uint8_t LED2pin = D6;
bool LED2status = LOW;

void setup() {
  Serial.begin(115200);
  delay(100);
  pinMode(LED1pin, OUTPUT);
  pinMode(LED2pin, OUTPUT);

  Serial.println("Connecting to ");
  Serial.println(ssid);

  //connect to your local wi-fi network
  WiFi.begin(ssid, password);

  //check wi-fi is connected to wi-fi network
  while (WiFi.status() != WL_CONNECTED) {
  delay(1000);
  Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected..!");
  Serial.print("Got IP: ");  Serial.println(WiFi.localIP());

  server.on("/", handle_OnConnect);
  server.on("/led1on", handle_led1on);
  server.on("/led1off", handle_led1off);
  server.on("/led2on", handle_led2on);
  server.on("/led2off", handle_led2off);
  server.onNotFound(handle_NotFound);

  server.begin();
  Serial.println("HTTP server started");
}
void loop() {
  server.handleClient();
  if(LED1status)
  {digitalWrite(LED1pin, HIGH);}
  else
  {digitalWrite(LED1pin, LOW);}
  
  if(LED2status)
  {digitalWrite(LED2pin, HIGH);}
  else
  {digitalWrite(LED2pin, LOW);}
}

void handle_OnConnect() {
  LED1status = LOW;
  LED2status = LOW;
  Serial.println("GPIO7 Status: OFF | GPIO6 Status: OFF");
  server.send(200, "text/html", SendHTML(LED1status,LED2status)); 
}

void handle_led1on() {
  LED1status = HIGH;
  Serial.println("GPIO7 Status: ON");
  server.send(200, "text/html", SendHTML(true,LED2status)); 
}

void handle_led1off() {
  LED1status = LOW;
  Serial.println("GPIO7 Status: OFF");
  server.send(200, "text/html", SendHTML(false,LED2status)); 
}

void handle_led2on() {
  LED2status = HIGH;
  Serial.println("GPIO6 Status: ON");
  server.send(200, "text/html", SendHTML(LED1status,true)); 
}

void handle_led2off() {
  LED2status = LOW;
  Serial.println("GPIO6 Status: OFF");
  server.send(200, "text/html", SendHTML(LED1status,false)); 
}

void handle_NotFound(){
  server.send(404, "text/plain", "Not found");
}

String SendHTML(uint8_t led1stat,uint8_t led2stat){
  String ptr = "<!DOCTYPE html> <html>\n";
  ptr +="<head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=no\">\n";
  ptr +="<title>LED Control</title>\n";
  ptr +="<style>html { font-family: Helvetica; display: inline-block; margin: 0px auto; text-align: center;}\n";
  ptr +="body{margin-top: 50px;} h1 {color: #444444;margin: 50px auto 30px;} h3 {color: #444444;margin-bottom: 50px;}\n";
  ptr +=".button {display: block;width: 80px;background-color: #1abc9c;border: none;color: white;padding: 13px 30px;text-decoration: none;font-size: 25px;margin: 0px auto 35px;cursor: pointer;border-radius: 4px;}\n";
  ptr +=".button-on {background-color: #1abc9c;}\n";
  ptr +=".button-on:active {background-color: #16a085;}\n";
  ptr +=".button-off {background-color: #34495e;}\n";
  ptr +=".button-off:active {background-color: #2c3e50;}\n";
  ptr +="p {font-size: 14px;color: #888;margin-bottom: 10px;}\n";
  ptr +="</style>\n";
  ptr +="</head>\n";
  ptr +="<body>\n";
  ptr +="<h1>ESP8266 Web Server</h1>\n";
    ptr +="<h3>Using Station(STA) Mode</h3>\n";
  
   if(led1stat)
  {ptr +="<p>LED1 Status: ON</p><a class=\"button button-off\" href=\"/led1off\">OFF</a>\n";}
  else
  {ptr +="<p>LED1 Status: OFF</p><a class=\"button button-on\" href=\"/led1on\">ON</a>\n";}

  if(led2stat)
  {ptr +="<p>LED2 Status: ON</p><a class=\"button button-off\" href=\"/led2off\">OFF</a>\n";}
  else
  {ptr +="<p>LED2 Status: OFF</p><a class=\"button button-on\" href=\"/led2on\">ON</a>\n";}

  ptr +="</body>\n";
  ptr +="</html>\n";
  return ptr;
}

this code is from a tutorial and nothing to do with my project. but i upload this to nodemcu directly and it is working perfectly.

What is your native language? Most languages can by typed on english keybaords
So what is the problem of using your english keyboard to type in your native language?

You have been given the advice to read how to get the best out of this forum in post #2

especcially read this

be specific

1 Like

my native language is Sinhala sir. i will surely refer this now. Sir, is there anything that cause u misguided.

ඔබ පළ කරන සෑම දෙයක්ම සිංහල භාෂාවෙන් ලිවිය යුතු අතර පසුව ගූගල් පරිවර්‍තනයට පරිවර්‍තනය කිරීමට ඉඩ දෙන්න. මම මෙම පාඨය මගේ මව් බස වූ ජර්මානු භාෂාවෙන් මෙහි ලියූ අතර පසුව එය ගූගල් පරිවර්‍තනයෙන් සිංහලයට පරිවර්තනය කළෙමි.

ව්‍යාකරණය එතරම් ලස්සන නොවනු ඇත, නමුත් මට සිංහල වචනයක් වත් කතා කිරීමට නොහැකි වුවද ඔබට සියල්ල වැටහෙනු ඇත.

ඉහත දැක්වෙන්නේ විශේෂ අක්ෂර වල ඇති පෙළයි. ඊට පහළින් ලතින් අකුරින් එකම පෙළ ඇත. ගූගල් පරිවර්‍තනය කෙතරම් බුද්ධිමත්ද යත් ǣ like වැනි වඩාත් විශේෂිත අක්ෂර සරල ඉංග්‍රීසි යතුරු පුවරුවක සරල "ඒ" හෝ "යූ" ලෙසද ලිවිය හැකිය.

ඔබ කළ යුත්තේ එය උත්සාහ කිරීම පමණි !!

oba paḷa karana sǣma deyakma siṁhala bhāṣāven liviya yutu atara pasuva gūgal parivartanayaṭa parivartanaya kirīmaṭa iḍa denna. mama mema pāṭhaya magē mav basa vū jarmānu bhāṣāven mehi liyū atara pasuva eya gūgal parivartanayen siṁhalayaṭa parivartanaya kaḷemi.

vyākaraṇaya etaram lassana novanu æta, namut maṭa siṁhala vacanayak vat katā kirīmaṭa nohæki vuvada obaṭa siyalla væṭahenu æta.

ihata dækvennē viśēṣa akṣara vala æti peḷayi. īṭa pahaḷin latin akurin ekama peḷa æta. gūgal parivartanaya ketaram buddhimatda yat ǣ like væni vaḍāt viśēṣita akṣara sarala iṁgrīsi yaturu puvaruvaka sarala "ē" hō "yū" lesada liviya hækiya.

oba kaḷa yuttē eya utsāha kirīma pamaṇi !!

1 Like

මම ඔබ කියූ දේ අනුගමනය කලා. ඔබට තවත් කිසියම්ම ආකාරයකින් මගේ මෙම ව්‍යාපෘතිය පිලිබදව ප්‍රශ්න තියෙද.

mama oba kiyuu dhei anugamanaya kalaa. obata thawath kisiyamma aakaarayakin magei mema w\yaapruthiya pilibadhawa prashna thiyedha.

I followed what you said. Do you have any other questions about my project?

My support in this forum is to give help to enable helping yourself.
I don't serve cooked fish = I don't post ready to use code

I teach fishing and cooking = I teach how to find information to learn from
and how to analyse what a program does

So it is up to you to ask specific questions.

I will give you some examples to - hopefully - you can extract the generalised pattern from the examples:

Your project has several parts:

  • connecting an ESP8266-board to a WiFi-network
  • accessing a firebase-database
  • transmitting data from an ESP8266-board to an arduino-mega-board using a serial connection

So some examples for specific questions are:

  • where can I find introductional information about how to .......

  • I have searched with google for a tutorial about ....... with the keywords ..... but had no success so far. Can you please make suggestions for better suited keywords to search for?

Can somebody post a link to a good tutorial about ..... ?

YOU

have to show a

minimum of OWN EFFORT

to

LEARN

through activities like described above (googling etc.)

best regards Stefan

1 Like