[Solved] Sketch that prevents me from uploading, Arduino micro.

I wanted to check which onboard leds were connected to the digital I/O pins so i made a simple quick script that put all the I/O's as outputs and would just go back and forth between the values.(I should have added a pushbutton that activated the script)

The script does that, but it also makes pin 0 and 1 blink,which are needed for serial communication?

If I try to upload code ,it just hangs on trying to upload code,with verbose output:
PORTS {COM10, } / {COM10, } => {}

I tried programming with an external FTDI programmer and connected the DTR to reset, 5v to 5v, gnd to gnd, rx to tx and tx to rx. the arduino resets, then,while trying to upload,just goes on running the old code.

Any ideas on how to resolve my issue?

That will not happen like you describe because the boot loader runs before the sketch so you can always upload. So there must be something else. Is anything connected to Pins 0&1?

Nothing else was connected to the pins, but I solved it, i had to force the reset quickly right after uploading. The verbose message said to do so. So this is resolved =)