Stepper motor, LED, Light sensor

(I have asked a moderator to move this to Programming where it belongs. It is not about education is it?)

I see nothing obviously wrong with the program, which leaves the possibility that your wiring for the motor is wrong - and it takes so much current that the Arduino goes in a bad state. Do you power the motor through some transistor/mosfet/driverchip or directly of the Arduino pins?