How do I upload a sketch to Arduino Mega 2560 via WiFi with the easiest way?
I think this is a good starting point:
but I don't the way they have directly connected pin 12 to reset. That is not guaranteed to give a reliable reset. The best alternative would be to use a bootloader that is activated after a watchdog reset on the Mega and reset via software. Another alternative would be to use a capacitor and transistor to ensure the reset pulse will always be at least as long as the 2.5 us duration specified by Atmel in the datasheet.