Mars Rover Model Problems

I am trying to make a simple model of a Mars Rover, using an Arduino UNO and an ESP8266...
The connections seem to be okay, as everything either works or has worked at a point. (they are like this)

This is a snippet of the relevant code I have used:

After running the programme on the Arduino, everything goes a bit temperamental.The Wifi connection will always become available to connect on my phone, but I will only occasionally be able to actually connect to it.The COM box replies with this most of the time, but with errors in different places:

Occasionally the box will display no errors, like so:

But it still doesnt work when I try and type the SSID code into google. A webpage with a simple 'Hello World' and two LED buttons is meant to come up, but instead either a blank page appears, or the html code for the page.
The relevant code for this in Arduino is:

Has anyone exerienced any similar problems, or knows how to sort this out? Thank you so much!! ^-^

reduce the work to sections.
test power connections and voltages.

if you have some single thing on the rover, get it to work, and run the comm link to get it to work.
then either add another or REM that out and get something else to work.

make sure you are not powering anthing from pins and that everything has a transistor or opto to isolate the pins.