After a lot of different pieces of code; moving pins about between D8 and D2 I finally got it working on D2. Reading the posts here and elsewhere the recommended pin is D8. I thought well it is working now so the code must be OK so I will move it onto D8 and it did not work. So I thought never mind it works on D2 so I will move it back and guess what; it does not work on D2 now either!
Just removed the card and inserted it again while powered up and it is now working again on D2! But the same trick does not work on D8 or back again on D2!!!!!