Chat freely about anything...

User avatar
By SuomyNonaPatri
#94330 First part I don't really understand, is that the 'ESP8266WiFi.h' library becomes unavailable when I select the mega as my board. That library is necessary to talk to the ESP8266, but I cant use it when uploading to my mega. It only works when I select 'generic ESP8266' as my board. So what am I supposed to voojio omegle do here?
User avatar
By Inq720
#94333
SuomyNonaPatri wrote:First part I don't really understand, is that the 'ESP8266WiFi.h' library becomes unavailable when I select the mega as my board. That library is necessary to talk to the ESP8266, but I cant use it when uploading to my mega. It only works when I select 'generic ESP8266' as my board. So what am I supposed to voojio omegle do here?


The ESP8266WiFi library will only work on the ESP8266. It is used to work with WiFi. It does not allow the ESP to communicate with the Mega. You mentioned you want MQTT which requires WiFi which requires the ESP8266. Most any project can do everything on the ESP8266. You have not said why you want to use the Mega... is it because of the number of pins you need for your project??? If so...

You'll need to setup some kind of communications protocol between the two. The most common is using serial communications.

What you are asking to do is WAY non-trivial - Do some undefined program on the Mega that must also talk both ways using a serial communications. And separately, create a program that talks both ways over serial communications and passes that to the MQTT communications talking over the WiFi.

That's why, if you can, to do everything on the ESP8266 and punt the Mega and the serial communications part. If you must have the Mega, you should google "Arduino serial communications with ESP8266" will probably get you a good tutorial.
Last edited by Inq720 on Tue Apr 19, 2022 6:48 am, edited 1 time in total.
User avatar
By rpiloverbd
#94334 Garbage usually occurs due to baud rate mismatch. Kindly check if you're selecting 9600 baud rate in your serial monitor too. Also, test your Arduino and ESP8266 separately with the easy Serial communication examples of the Arduino IDE.