ledMode seems to break script??

You've #included the SPI library. That would indicate that one of the components you're using is using SPI. Pin 13 is part of the SPI bus. It's the clock or CLK pin. So you can't use the LED on that pin.