After that I moved the pins 2 and 3 to 7 and 6 and I used an online graphical site for coding where I can download the generated files: www.arduinoblocks.com
The problem is when the arduino tries to connect to wifi this happens (as I can see this in the IDE's serial monitor):
⸮[WiFiEsp] Initializing ESP module
[WiFiEsp] >>> TIMEOUT >>>
[WiFiEsp] Initilization successful - 2.0.0
Attempting to connect to WPA SSID: Atomos
[WiFiEsp] >>> TIMEOUT >>>
[WiFiEsp] Failed connecting to Atomos
Attempting to connect to WPA SSID: Atomos
[WiFiEsp] Connected to Atomos
Attempting to connect to WPA SSID: Atomos
[WiFiEsp] Connected to Atomos
and it keeps going like that... Maybe I can add some lines to the code so I can have more feedback to see exactly what is the problem? I suppose it can be that the module does not get an IP but how I can be sure?
You can post that here.
Personally i don't support the use of AT-commands initiated from a sketch a different machine (like a Mega)
It is to cumbersome and inefficient compared to programming the ESP directly.