The WiFi Mega is flashed and working. I use AT commands to connect in STA mode to my home network. I can see the device in my router list of connected devices. I try to ping its IP and I get an error from my ip address saying "destination host undreachable". It seems unusual that the reply is from my IP and not the one I am pinging. UPDATE: It DOES ping occasionally. Very unreliable.
So I loaded the exact same sketch on a different clone Mega connected with a breadboard to an ESP-01S. It works perfectly.
I am not sure how to debug this. Obviously the firmware of the devices is different. The Mega Wifi has an ESP8266EX and a chip that looks like a 32mbit 2MB Flash. The ESP-01S has a 8mbit 1MB Puya flash chip.
Here are the versions:
Working - this is an old board I pulled out of the drawer. It has the factory firmware:
AT version:126.96.36.199(Jul 14 2016 18:54:01)
Farylink Technology Co., Ltd. v188.8.131.52
May 11 2017 22:23:58
Not Working - I tried many different flash attempts until this one let me see AT responses:
AT version:184.108.40.206(Apr 13 2018 11:10:59)
compile time:Jun 7 2018 19:34:26
Bin version(Wroom 02):1.6.2
There are a lot of unknowns trying to flash the right firmware on this no name wifi mega, and I'm not even sure that's the issue, but it is the only thing I can think to try. I notice "Wroom" listed and I don't have a Wroom chip. The only version I could get to even boot on this board was the NonOs SDK 2.2.1 files. Maybe I should try one of these: AT | Espressif Systems I haven't found out what the different firmware are. For example, do I need the nonOS AT or just the AT versions?
There is no Arduino WiFi Mega so please post a link to the board you're using!
Have you tried to place your board in front of your router. This may eliminate problems with a bad WiFi antenna.
Is this the Arduino Mega with an ESP8266?
One thing to realize with the old ESP8266 is most of them come with a 4 Mbit flash, thus you can't use the newer firmware that require at least 8 Mbit. You can only load an NonOS SDK/AT firmware in that case.
In either case, the AT command set differ for each version of NonOS SDK, but most of the time, the newer version implements additional commands and keeps the old one. In some rare instances, some old AT commands are retired. It's possible that your Arduino code worked for a particular AT command set and now that a different firmware is loaded on the ESP8266, the Arduino code simply doesn't work.
You can try directly interface with the ESP8266 via a serial connection and type the AT command yourself to see which one works and which one doesn't. You can get the full AT instruction set from Espressif website
Yes, it is an unbranded "WiFi Mega", like the Robotdyn and WeMos. I thought all ESP8266 chips came with the AT Command set on them. In order to test, I just wanted to connect the switches so that the ESP8266 portion of the board would talk through the UART to Putty or the Arduino Serial Monitor. The chip would not respond to AT commands. Whatever was flashed onto the chip was not an AP or AT and would just reset. So I tried to flash different firmware from Expressif. I think I know a lot more now, and I can try different settings and also a few more versions of firmware. When I could type AT commands and they all worked, I was very excited, I can use the AT commands to connect to my home network, but then I can't ping it reliably. So something is wrong with the firmware I think.