Would one want to use the previous arduino code in a wifi situation you should delete this line
Serial.begin(115200); //opens serial port, sets data rate to 115200 bps
while (!Serial) {
}; //gives time to serial to open
If you don't the arduino loop, and even the end of the setup won't happen as the serial connection isn't available.